zhuyiyi 7 月之前
父节点
当前提交
fdba955368

+ 116 - 0
BizCom/Dao/CeErpSupplierProductTime.cs

@@ -0,0 +1,116 @@
+using Castle.ActiveRecord;
+using System;
+using NHibernate.Criterion;
+
+namespace BizCom
+{
+    [ActiveRecord("CE_ErpSupplierProductTime")]
+    public class CeErpSupplierProductTime : ComBase<CeErpSupplierProductTime>
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        [PrimaryKey(PrimaryKeyType.Native)]
+        public int ID { get; set; }
+
+        private int _supplierId = 0;
+        /// <summary>
+        /// 车间id
+        /// </summary>
+        [Property]
+        public int supplierId
+        {
+            get { return _supplierId; }
+            set { _supplierId = value; }
+        }
+
+        private string _productId = "";
+        /// <summary>
+        /// 产品id
+        /// </summary>
+        [Property]
+        public string productId
+        {
+            get { return _productId; }
+            set { _productId = value; }
+        }
+
+        private int _quantity = 0;
+        /// <summary>
+        /// 数量
+        /// </summary>
+        [Property]
+        public int quantity
+        {
+            get { return _quantity; }
+            set { _quantity = value; }
+        }
+
+        private string _deadLine = "00:00";
+        /// <summary>
+        /// 截稿时间
+        /// </summary>
+        [Property]
+        public string deadLine
+        {
+            get { return _deadLine; }
+            set { _deadLine = value; }
+        }
+
+        private int _sendDay = 0;
+        /// <summary>
+        /// 发货时间
+        /// </summary>
+        [Property]
+        public int sendDay
+        {
+            get { return _sendDay; }
+            set { _sendDay = value; }
+        }
+
+        private string _dayDeadLine = "00:00";
+        /// <summary>
+        /// 当日截稿时间
+        /// </summary>
+        [Property]
+        public string dayDeadLine
+        {
+            get { return _dayDeadLine; }
+            set { _dayDeadLine = value; }
+        }
+
+        private string _craft = "";
+        /// <summary>
+        /// 工艺
+        /// </summary>
+        [Property]
+        public string craft
+        {
+            get { return _craft; }
+            set { _craft = value; }
+        }
+
+        private string _supplierName = "";
+        /// <summary>
+        /// 车间名称
+        /// </summary>
+        [Property]
+        public string supplierName
+        {
+            get { return _supplierName; }
+            set { _supplierName = value; }
+        }
+
+        private string _productName = "";
+        /// <summary>
+        /// 品类名称
+        /// </summary>
+        [Property]
+        public string productName
+        {
+            get { return _productName; }
+            set { _productName = value; }
+        }
+
+    }
+}

+ 100 - 0
SiteCore/Handler/sync.order.cs

@@ -13448,6 +13448,106 @@ namespace SiteCore.Handler
             writeGridDataTableJson(dStruct.TotalCount, dt);
         }
 
+        public void get_supplier_product_time_list()
+        {
+            DataStruct dStruct = GetPostStruct();
+            List<string> lw = new List<string>();
+
+            string supplier = GetPostString("supplier");
+            if (supplier.Length > 0) lw.Add(string.Format("supplierName = '{0}'", supplier));
+
+
+            string posTag = CurrentUser.UserPost.Post.Code;
+            if (posTag != "SysAdmin")
+            {
+                lw.Add(string.Format("SupplierId in ({0})", CurrentUser.User.pemVend));
+            }
+            dStruct.MainWhere = string.Join(" and ", lw.ToArray());
+            DataTable dt = WebCache.GetData("CE_ErpSupplierProductTime", dStruct);
+            writeGridDataTableJson(dStruct.TotalCount, dt);
+        }
+
+        public void saveSupplierProductTime()
+        {
+            string productId = GetPostString("productId");
+            if (string.IsNullOrEmpty(productId))
+            {
+                returnErrorMsg("缺少必要的参数");
+                return;
+            }
+            string productName = GetPostString("productName");
+            int supplierId = GetPostInt("supplierId");
+            if (supplierId == 0)
+            {
+                returnErrorMsg("缺少必要的参数");
+                return;
+            }
+            int quantity = GetPostInt("quantity");
+            int sendDay = GetPostInt("sendTime");
+            string supplierName = GetPostString("supplierName");
+            string craft = GetPostString("craft");
+            string deadLine = GetPostString("deadLine");
+            string dayDeadLine = GetPostString("dayDeadLine");
+            try
+            {
+                int eid = GetPostInt("eid");
+                CeErpSupplierProductTime ceErpSupplierProductTime = CeErpSupplierProductTime.Get(eid);
+                
+                if (ceErpSupplierProductTime == null)
+                {
+                    ceErpSupplierProductTime = new CeErpSupplierProductTime();
+                }
+                ceErpSupplierProductTime.productId = productId;
+                ceErpSupplierProductTime.productName = productName;
+                ceErpSupplierProductTime.supplierId = supplierId;
+                ceErpSupplierProductTime.supplierName = supplierName;
+                ceErpSupplierProductTime.craft = craft;
+                ceErpSupplierProductTime.sendDay = sendDay;
+                ceErpSupplierProductTime.quantity = quantity;
+                if (!string.IsNullOrEmpty(deadLine))
+                {
+                    ceErpSupplierProductTime.deadLine = TimeSpan.Parse(deadLine).ToString();
+                }
+                if (!string.IsNullOrEmpty(dayDeadLine))
+                {
+                    ceErpSupplierProductTime.dayDeadLine = TimeSpan.Parse(dayDeadLine).ToString();
+
+                }
+                if (ceErpSupplierProductTime.ID == 0)
+                {
+                    ceErpSupplierProductTime.Save();
+                }
+                else
+                {
+                    ceErpSupplierProductTime.Update();
+                }
+            }
+            catch (Exception e)
+            {
+            }
+            returnSuccessMsg("保存成功");
+            return;
+        }
+
+        public void delSupplierProductTime()
+        {
+            int eid = GetPostInt("eid");
+            if (eid > 0)
+            {
+                CeErpSupplierProductTime ceErpSupplierProductTime = CeErpSupplierProductTime.Get(eid);
+                if (ceErpSupplierProductTime == null)
+                {
+                    returnErrorMsg("查无数据");
+                    return;
+                }
+                ceErpSupplierProductTime.Delete();
+                returnSuccessMsg("保存成功");
+                return;
+            }
+            returnErrorMsg("缺少必要的参数");
+
+        }
+
         public void getExpressInfo()
         {
             string ctid = GetPostString("ctid");

+ 11 - 0
SiteCore/taobao/apiCaiYingTong.cs

@@ -548,7 +548,18 @@ namespace SiteCore.Handler
                 else
                 {
                     CeErpTradeResponsible.dateByTid(entity.ctid);
+                    string numSql = string.Format("SELECT COUNT ( * ) AS BackNum FROM dbo.Ce_ErpTradeAfterSaleLog WHERE tid = '{0}' AND Con in ('责任主管不认可','供应商不认可')", ceErpTradeResponsible.tid);
+                    DataTable dt = DbHelper.DbConn.ExecuteDataset(numSql).Tables[0];
+                    int num = Convert.ToInt32(dt.Rows[0]["BackNum"]);
+                    if (num <= 1)
+                    {
 
+                        entity.AfterSaleState = 1;
+                    }
+                    else
+                    {
+                        entity.AfterSaleState = 5;
+                    }
                     CeErpTradeAfterSaleExtend ceErpTradeAfterSaleExtend = CeErpTradeAfterSaleExtend.getByTid(entity.ctid);
                     if (ceErpTradeAfterSaleExtend != null)
                     {

+ 7 - 7
SiteCore/taobao/apiDesign.cs

@@ -660,16 +660,16 @@ namespace SiteCore.Handler
                                 return;
                             }
                         }
-
-                        ceErpTradeCell.DesignUserId = ceErpUser.ID;
-                        ceErpTradeCell.OrderState = orderState;
+                        List<string> sqlList = new List<string>();
+                        sqlList.Add("set DesignUserId=" + ceErpUser.ID);
+                        sqlList.Add("set OrderState=" + orderState);
                         if (orderState == 4)
                         {
-                            ceErpTradeCell.WaitDesignTime = DateTime.Now;
-                            ceErpTradeCell.StartDesignTime = DateTime.Now;
+                            sqlList.Add("set WaitDesignTime= GETDATE()");
+                            sqlList.Add("set StartDesignTime= GETDATE()");
                         }
-                        ceErpTradeCell.UpdateTime = DateTime.Now;
-                        ceErpTradeCell.Update();
+                        sqlList.Add("set UpdateTime= GETDATE()");
+                        CeErpTradeCell.ExecuteNonQuery(string.Format("UPDATE CE_ErpTradeCell {0} WHERE ctid = '{1}'", string.Join(",", sqlList), ceErpTradeCell.ctid));
                         LogHelper.addLog(ceErpTradeCell.ctid, 3542, "接口请求:" + orderState, ceErpTradeCell.OrderState);
                         commonHelper.UpdateRelationOrder(tid);
                         return;

+ 1 - 1
SiteCore/taobao/tmcHelper.cs

@@ -2759,7 +2759,7 @@ namespace SiteCore
                     newmemo += "-";
                     newmemo += smallList[1];
                     newmemo += "(";
-                    newmemo += father.tid;
+                    newmemo += entity.OrderSn;
                     newmemo += ")";
                     newmemo += "-";
                     newmemo += smallList[4];

+ 221 - 0
Web/EArc/SupplierProductTime.aspx

@@ -0,0 +1,221 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/View.master" AutoEventWireup="true" CodeFile="SupplierProductTime.aspx.cs" Inherits="EArc_SupplierProductTime" %>
+
+<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
+    <script type="text/javascript">
+        var exData = null;
+        var edit_id = "";
+        function addFn() {
+            edit_id = "";
+            mini.get("productId").setValue("");
+            mini.get("supplierId").setValue("");
+            $("#craft").val("");
+            mini.get("dayDeadLine").setValue("");
+            mini.get("deadLine").setValue("");
+            $("#sendTime").val("");
+            $("#quantity").val("");
+            mini.get("add_win").show();
+        }
+
+        function editFn(eid) {
+            edit_id = eid;
+            var rec = grid.getSelected();
+            mini.get("productId").setValue(rec.productId);
+            mini.get("supplierId").setValue(rec.supplierId);
+            $("#craft").val(rec.craft);
+            mini.get("dayDeadLine").setValue(rec.dayDeadLine);
+            mini.get("deadLine").setValue(rec.deadLine);
+            $("#sendTime").val(rec.sendDay);
+            $("#quantity").val(rec.quantity);
+            mini.get("add_win").show();
+        }
+
+        function saveFn() {
+            let params = {};
+            params.eid = edit_id;
+            params.productId = mini.get("productId").getValue();
+            if (params.productId == "") {
+                alert("产品不允许为空");
+                return;
+            }
+            params.productName = mini.get("productId").getText();
+            params.supplierId = mini.get("supplierId").getValue();
+            if (params.supplierId == "") {
+                alert("车间不允许为空");
+                return;
+            }
+            params.supplierName = mini.get("supplierId").getText();
+            params.craft = $("#craft").val();
+            params.dayDeadLine = mini.get("dayDeadLine").getFormattedValue();
+            params.deadLine = mini.get("deadLine").getFormattedValue();
+            if (isNaN(Number($("#sendTime").val()))) {
+                alert("请输入正确发货时间");
+                return;
+            }
+            if (isNaN(Number($("#quantity").val()))) {
+                alert("请输入正确数量");
+                return;
+            }
+            params.sendTime = Number($("#sendTime").val());
+            params.quantity = Number($("#quantity").val());
+            postAjax("saveSupplierProductTime", params, function (data) {
+                mini.get("add_win").hide();
+                resultShow(data, "grid.reload();");
+            });
+        }
+
+        function delFn(eid) {
+            if (!confirm("确认删除?")) return;
+            postAjax("delSupplierProductTime", "eid=" + eid, function (data) {
+                resultShow(data, "grid.reload();");
+            });
+        }
+
+
+        function cancelFn() {
+            mini.get("add_win").hide();
+        }
+
+        function actionRenderer(e) {
+            var grid = e.sender;
+            var record = e.record;
+            var id = record.ID;
+            var rowIndex = e.rowIndex;
+            var html = "";
+            html += getGridBtn("edit", "修改", "editFn('" + id + "')");
+            html += getGridBtn("stop", "删除", "delFn('" + id + "')");
+            return html;
+        }
+
+        function conFn(e) {
+            //alert(e.value);
+            var v = e.value;
+            v = e.value.replace(/&lt;br&gt;/g, "");
+            v = v.replace(/<br>/g, "");
+            //v = e.value.replace(/§/g, "");
+            return v;
+        }
+
+        function stateFn(e) {
+            if (e.value == "1") return "启用";
+            return "<span style=\"color:#ff0000\">禁用</span>";
+        }
+    </script>
+    <style type="text/css">
+        .win_tb {
+            width: 96%;
+            margin-left: auto;
+            margin-right: auto;
+            margin-top: 10px;
+            background-color: #dedede;
+        }
+
+            .win_tb td {
+                height: 36px;
+                background-color: #fff;
+                font-size: 14px;
+                padding: 5px;
+            }
+
+            .win_tb input[type=text] {
+                width: 90%;
+                height: 24px;
+                font-size: 14px;
+            }
+
+            .win_tb input[type=checkbox] {
+                width: 18px;
+                height: 18px;
+            }
+
+            .win_tb select {
+                font-size: 14px;
+                height: 30px;
+                padding: 0px 5px;
+            }
+
+            .win_tb .td1 {
+                color: #666;
+                background-color: #F8F8F8;
+                text-align: center;
+            }
+
+            .win_tb .td2 {
+            }
+    </style>
+</asp:Content>
+<asp:Content ID="Content2" ContentPlaceHolderID="btn" runat="Server">
+</asp:Content>
+<asp:Content ID="Content3" ContentPlaceHolderID="toolbar" runat="Server">
+</asp:Content>
+<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="Server">
+    <div class="mini-fit">
+        <div id="m_grid" class="mini-datagrid" style="width: 100%; height: 100%;" showemptytext="true" emptytext="暂无记录" url="../handler/sync.ashx?t=get_supplier_product_time_list">
+            <div property="columns">
+                <div type="indexcolumn" width="20"></div>
+                <div field="productName" width="100" align="center" headeralign="center">产品类型</div>
+                <div field="supplierName" width="40" align="center" headeralign="center">车间</div>
+                <div field="craft" width="40" align="center" headeralign="center">工艺</div>
+
+                <div field="dayDeadLine" width="40" align="center" headeralign="center">当日发货截稿时间</div>
+                <div field="deadLine" width="40" align="center" headeralign="center">截稿时间</div>
+                <div field="sendDay" width="40" align="center" headeralign="center">发货时间</div>
+                <div field="quantity" width="40" align="center" headeralign="center">数量</div>
+                <div name="action" width="120" headeralign="center" align="center" renderer="actionRenderer" cellstyle="padding:0;">#</div>
+            </div>
+        </div>
+    </div>
+
+    <div id="add_win" class="mini-window" title="发货信息" style="width: 750px; height: 450px; position: relative; display: none">
+        <table class="win_tb" border="0" cellpadding="0" cellspacing="1">
+            <tr>
+                <td class="td1" colspan="1">车间</td>
+                <td class="td2" colspan="3">
+                    <input id="supplierId" class="mini-combobox" style="width: 90%;" textfield="name" valuefield="id" required="true" allowinput="true" valuefromselect="true" url="../handler/sync.ashx?t=get_sel_supplier" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1" colspan="1">产品</td>
+                <td class="td2" colspan="3">
+                    <input id="productId" class="mini-combobox" multiselect="true" style="width: 90%;" textfield="name" valuefield="id" required="true" allowinput="true" valuefromselect="true" url="../handler/sync.ashx?t=get_sel_product" />
+                </td>
+            </tr>
+
+            <tr>
+                <td class="td1" colspan="1">工艺</td>
+                <td class="td2" colspan="3">
+                    <input type="text" id="craft" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1" colspan="1">当日发货截稿时间</td>
+                <td class="td2" colspan="1">
+                    <input id="dayDeadLine" class="mini-timespinner" format="H:mm" />
+
+                </td>
+                <td class="td1" colspan="1">数量</td>
+                <td class="td2" colspan="1">
+                    <input type="text" id="quantity" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1" colspan="1">截稿时间</td>
+                <td class="td2" colspan="1">
+                    <input id="deadLine" class="mini-timespinner" format="H:mm" />
+                </td>
+                <td class="td1" colspan="1">发货时间</td>
+                <td class="td2" colspan="1" style="display: flex; align-items: center;">
+                    <input type="text" id="sendTime" /><span>(天)</span>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="4">
+                    <div class="win_btn" style="text-align: center;">
+                        <a class="mini-button" iconcls="icon-ok" onclick="saveFn">保存</a>&nbsp;
+                        <a class="mini-button" iconcls="icon-cancel" onclick="cancelFn">取消</a>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </div>
+</asp:Content>
+

+ 43 - 0
Web/EArc/SupplierProductTime.aspx.cs

@@ -0,0 +1,43 @@
+using SiteCore;
+using SQLData;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Utils.Serialization;
+
+public partial class EArc_SupplierProductTime : BasePage
+{
+    protected override void OnPreInit(EventArgs e)
+    {
+        _repTitle = "车间产品工时";
+        PmTag = "supplierProductTime";
+        //_selfCheckPermission = true;
+        _keyFilterVisible = true;
+        _addVisible = true;
+    }
+
+    protected void Page_Load(object sender, EventArgs e)
+    {
+        if (!IsPostBack)
+        {
+            //StringBuilder sql = new StringBuilder();
+            //sql.AppendFormat("select * from s_runinfotype");
+            //DataSet ds = DbHelper.DbConn.ExecuteDataset(sql.ToString());
+            //DataTable dt = ds.Tables[0];
+            //AppendScript("tData=" + JsonString.DataTable2Json(dt) + ";");
+
+            //selType.DataSource = dt;
+            //selType.DataValueField = "ID";
+            //selType.DataTextField = "Name";
+            //selType.DataBind();
+        }
+        //foreach (DataRow dr in dt.Rows)
+        //{
+        //}
+    }
+}

+ 1 - 0
Web/Global.asax

@@ -115,6 +115,7 @@
                                  typeof(CeErpDeliverMark),
                                  typeof(CeErpPackData),
                                  typeof(CeErpPackDataItem),
+                                 typeof(CeErpSupplierProductTime),
                                  typeof(CeErpDataSendOrderInfo)
 
                              };

+ 8 - 7
ecomServer/MainForm.cs

@@ -284,7 +284,7 @@ namespace ErpServer
                                 {
                                     case "updatestate_close":
                                         {
-                                            sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,isRefund=2 where tid='" + dr["ctid"] + "' and isAfterSaleOrder=0";
+                                            sql = "update CE_ErpTradeCell  set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,isRefund=2 where tid='" + dr["ctid"] + "' and isAfterSaleOrder=0";
                                             SqlHelper.ExecuteNonQuery(sql);
                                             break;
                                         }
@@ -293,15 +293,15 @@ namespace ErpServer
                                             //sql.AppendFormat("update ce_ErpTradeCell set OrderState={1},IsUrgency=0 where IsPreDelivery=0 and tid='{0}' and SplitTag='' and isAfterSaleOrder=0;", tObj.refOid, (int)OrderState.交易完成);
                                             //拆分单更新,只有下单完成的才更新成已发货已完成
                                             //sql.AppendFormat("update ce_ErpTradeCell set OrderState={1},IsUrgency=0 where IsPreDelivery=0 and tid='{0}' and SplitTag!='' and OrderState>5 and isAfterSaleOrder=0;", tObj.refOid, (int)OrderState.交易完成);
-                                            sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0 where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
-                                            sql += "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0 where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
+                                            sql = "update CE_ErpTradeCell  set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0 where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
+                                            sql += "update CE_ErpTradeCell  set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0 where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
                                             SqlHelper.ExecuteNonQuery(sql);
                                             break;
                                         }
                                     case "updatestate_shipped":
                                         {
-                                            sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
-                                            sql += "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
+                                            sql = "update CE_ErpTradeCell  set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
+                                            sql += "update CE_ErpTradeCell  set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
                                             SqlHelper.ExecuteNonQuery(sql);
                                             break;
                                         }
@@ -309,10 +309,10 @@ namespace ErpServer
                                         {
                                             if (Convert.ToInt32(dr["refundState"]) == 1)
                                             {
-                                                sql = "update CE_ErpTradeCell WITH(ROWLOCK) set IsRefund=" + dr["refundState"] + ",IsReadTag=2  where isAfterSaleOrder=0 and tid='" + dr["ctid"] + "'";
+                                                sql = "update CE_ErpTradeCell  set IsRefund=" + dr["refundState"] + ",IsReadTag=2  where isAfterSaleOrder=0 and tid='" + dr["ctid"] + "'";
                                             }
                                             else
-                                                sql = "update CE_ErpTradeCell WITH(ROWLOCK) set IsRefund=" + dr["refundState"] + " where isAfterSaleOrder=0 and tid='" + dr["ctid"] + "'";
+                                                sql = "update CE_ErpTradeCell  set IsRefund=" + dr["refundState"] + " where isAfterSaleOrder=0 and tid='" + dr["ctid"] + "'";
                                             SqlHelper.ExecuteNonQuery(sql);
                                             break;
                                         }
@@ -352,6 +352,7 @@ namespace ErpServer
                             }
                             catch (Exception ex)
                             {
+                                idLst.Remove(dr["id"].ToString());
                                 if (ex.Message.IndexOf("死锁") != -1)
                                 {
                                     bu_err++;