Преглед на файлове

核价后台:1、床垫清单,新增同步L1资料;2、修复已知问题

chen_yjin преди 3 седмици
родител
ревизия
056ddd4c19

+ 2 - 2
JLHHJSvr/Com/GetERPMtrlTypeList.cs

@@ -21,7 +21,7 @@ namespace JLHHJSvr.Com
 
     public sealed class GetERPMtrlTypeListResponse : LJResponse
     {
-        public List<u_mtrltype> list { get; set; }
-        public List<Recursion<u_mtrltype>> reList { get; set; }
+        public List<u_mtrltype_erp> list { get; set; }
+        public List<Recursion<u_mtrltype_erp>> reList { get; set; }
     }
 }

+ 1 - 0
JLHHJSvr/Com/GetPriceList.cs

@@ -10,6 +10,7 @@ namespace JLHHJSvr.Com
     public sealed class GetPriceListRequest : ILJRequest<GetPriceListResponse>
     {
         public string token { get; set; }
+        public int? inuse { get; set; }
 
         public override string GetApiName()
         {

+ 0 - 24
JLHHJSvr/Com/Model/erp_mtrldef.cs

@@ -1,24 +0,0 @@
-using LJLib.DAL.SQL;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace JLHHJSvr.Com.Model
-{
-    [PK(new[] { "mtrlid" })]
-    public sealed class erp_mtrldef
-	{
-		public int? rowNum { get; set; }
-		public int? mtrlid { get; set; }
-		public int? mtrltypeid { get; set; }
-		public string mtrltype { get; set; }
-		public string mtrlcode { get; set; }
-		public string mtrlname { get; set; }
-		public string mtrlmode { get; set; }
-		public string unit { get; set; }
-		public string mtrlengname { get; set; }
-		public string zxmtrlmode { get; set; }
-		public int? dftwrkgrpid { get; set; }
-    }
-}

+ 121 - 0
JLHHJSvr/Com/Model/u_mtrldef.cs

@@ -0,0 +1,121 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mtrlid" })]
+    public sealed class u_mtrldef
+	{
+		public int? mtrltypeid { get; set; }
+        public int? dftwrkgrpid { get; set; }
+        public int? mtrlid { get; set; }
+        public string mtrlcode { get; set; }
+        public string mtrlname { get; set; }
+        public int? mtrlorigin { get; set; }
+        public string mtrltype { get; set; }
+        public string handtype { get; set; }
+        public string unit { get; set; }
+        public string mtrlmode { get; set; }
+        public string mtrlsectype { get; set; }
+        public string zxmtrlmode { get; set; }
+        public string usermtrlmode { get; set; }
+        public string mtrlengname { get; set; }
+        public string material { get; set; }
+        public string barcode { get; set; }
+        public string dscrp { get; set; }
+        public int? issuliao { get; set; }
+        public byte? isuse { get; set; }
+        //public byte? iflimitprice { get; set; }
+        public decimal? net_weight { get; set; }
+        public decimal? gross_weight { get; set; }
+        public decimal? cubage { get; set; }
+        public string prdpackcode { get; set; }
+        public DateTime? opdate { get; set; }
+        public string opemp { get; set; }
+        public int? buyunit { get; set; }
+        public int? buydec { get; set; }
+        public string unit_buy { get; set; }
+        public string unit_scll { get; set; }
+        public string unit_sale { get; set; }
+        public decimal rate_buy { get; set; }
+        public decimal rate_scll { get; set; }
+        public decimal rate_sale { get; set; }
+        public decimal saleunit { get; set; }
+        public int? price_ifpz_buy { get; set; }
+        public int? iflimitprice { get; set; }
+        public int? flag { get; set; }
+        public int? statustype { get; set; }
+        public int? woodcodetype { get; set; }
+        public int? pcodetype { get; set; }
+        public int? status_check { get; set; }
+        public int? woodcode_check { get; set; }
+        public int? pcode_check { get; set; }
+        public byte? statusflag { get; set; }
+        public byte? woodcodeflag { get; set; }
+        public byte? pcodeflag { get; set; }
+        public byte? Mtrlorigin { get; set; }
+        public decimal? LMsaleprice { get; set; }
+        public decimal? gbrate { get; set; }
+        public int? ifcheckaddqty { get; set; }
+        public string strcheckaddqty { get; set; }
+        public string woodcode_config { get; set; }
+        public string rowNum { get; set; }
+        public string status_config { get; set; }
+        public string woodcode_configName { get; set; }
+        public string status_configName { get; set; }
+        public decimal? quoteqty { get; set; }
+        #region mtrlware
+        public decimal? noallocqty { get; set; }
+        #endregion
+        /// <summary>
+        /// 主图MD5
+        /// </summary>
+        public string picmd5 { get; set; }
+        public string storagename { get; set; }
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal? price { get; set; }
+        public decimal? taxrate { get; set; }
+        public decimal? rebate { get; set; }
+
+        /// <summary>
+        /// 原价
+        /// </summary>
+        public decimal? price_ori { get; set; }
+        /// <summary>
+        /// 参考装柜量
+        /// </summary>
+        public decimal? ck_packqty { get; set; }
+        /// <summary>
+        /// 价格表币种
+        /// </summary>
+        public int moneyid { get; set; }
+        public int fjcnt { get; set; }
+
+        public decimal kcqty { get; set; }
+        public decimal xqqty { get; set; }
+        public decimal maxqty { get; set; }
+        /// <summary>
+        /// 配置1默认值
+        /// </summary>
+        public string dftStatus { get; set; }
+        /// <summary>
+        /// 配置2默认值
+        /// </summary>
+        public string dftWoodcode { get; set; }
+        /// <summary>
+        /// 配置3默认值
+        /// </summary>
+        public string dftPcode { get; set; }
+        /// <summary>
+        /// 分部id
+        /// </summary>
+        public int? scid { get; set; }
+        public int? lspacklimit { get; set; }
+        public decimal? planprice { get; set; }
+    }
+}

+ 21 - 0
JLHHJSvr/Com/Model/u_mtrltype_erp.cs

@@ -0,0 +1,21 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mtrltypeid" })]
+    public sealed class u_mtrltype_erp
+    {
+        public int? mtrltypeid { get; set; }
+        public string mtrltype { get; set; }
+        public string handtype { get; set; }
+        public byte? sonflag { get; set; }
+        public int? parentid { get; set; }
+        public byte? mtrlprp { get; set; }
+        public string typecode { get; set; }
+        public string typecodestr { get; set; }
+    }
+}

+ 3 - 1
JLHHJSvr/Com/UpdateL1Basicinfo.cs

@@ -18,6 +18,8 @@ namespace JLHHJSvr.Com
 
     public sealed class UpdateL1BasicinfoResponse : LJResponse
     {
-        public u_mattress mattress { get; set; }
+        public int mtrlnum { get; set; }
+        public int wkgnum { get; set; }
+        public int mtrltypenum { get; set; }
     }
 }

+ 3 - 0
JLHHJSvr/DataStore/_Mapper_pricelistid.xml

@@ -6,6 +6,9 @@ SELECT u_pricelist.pricelistid,
 FROM u_pricelist
   </selectstr>
   <where>
+	  <when>
+		  u_pricelist.inuse = 0
+	  </when>
   </where>
   <displayfields>
   </displayfields>

+ 5 - 0
JLHHJSvr/Excutor/GetComputeMattressExcutor.cs

@@ -51,6 +51,11 @@ namespace JLHHJSvr.Excutor
                     }
                 }
 
+                if (request.mattress.dannum_type.Value == 0)
+                {
+                    request.mattress.dannum_type = 2; // 默认标准
+                }
+
                 foreach (var mx in request.mattressMx)
                 {
                     AutoInit.AutoInitS(cmd, mx);

+ 14 - 1
JLHHJSvr/Excutor/GetPriceListExcutor.cs

@@ -30,6 +30,18 @@ namespace JLHHJSvr.Excutor
             {
                 con.Open();
 
+                var whereStr = "";
+
+                if (request.inuse != null)
+                {
+                    whereStr += "inuse = @inuse";
+                }
+
+                if (!string.IsNullOrEmpty(whereStr))
+                {
+                    whereStr = " WHERE " + whereStr;
+                }
+
                 cmd.CommandText = @"SELECT ROW_NUMBER() OVER (ORDER BY u_pricelist.pricelistid) AS RowNumber,   
                                          u_pricelist.pricelistid,   
                                          u_pricelist.pricelistname,   
@@ -41,8 +53,9 @@ namespace JLHHJSvr.Excutor
                                          auditemp,
                                          auditdate,
                                          inuse
-                                    FROM u_pricelist";
+                                    FROM u_pricelist" + whereStr;
                 cmd.Parameters.Clear();
+                if (request.inuse != null) cmd.Parameters.AddWithValue("@inuse", request.inuse);
                 rslt.list = new List<u_pricelist>();
                 using (var reader = cmd.ExecuteReader())
                 {

+ 3 - 1
JLHHJSvr/Excutor/SaveShrinkageExcutor.cs

@@ -63,7 +63,9 @@ namespace JLHHJSvr.Excutor
                         else
                         {
                             //修改
-                            var fields = @"minvalue,maxvalue,shrinkage";
+                            request.shrinkage.createtime = dtNow;
+                            request.shrinkage.createby = tokendata.username;
+                            var fields = @"minvalue,maxvalue,shrinkage,createtime,createby";
                             DbSqlHelper.Update(cmd, "u_shrinkage", null, request.shrinkage, "shrinkageid", fields);
                         }
 

+ 90 - 6
JLHHJSvr/Excutor/UpdateL1BasicinfoExcutor.cs

@@ -5,6 +5,7 @@ using JLHHJSvr.BLL;
 using JLHHJSvr.Com;
 using JLHHJSvr.Com.Model;
 using JLHHJSvr.Helper;
+using JLHHJSvr.Tools;
 using LJLib.DAL.SQL;
 using LJLib.Net.SPI.Server;
 using Newtonsoft.Json.Linq;
@@ -24,13 +25,18 @@ namespace JLHHJSvr.Excutor
                 return;
             }
 
+            UpdateL1Basic(rslt);
+        }
+
+        private static void UpdateL1Basic(UpdateL1BasicinfoResponse rslt)
+        {
             using (var con = new SqlConnection(GlobalVar.ConnectionString))
             using (var cmd = con.CreateCommand())
             {
                 con.Open();
 
-
-                var maxMtrlModdate = (DateTime?)null;
+                #region 同步u_mtrldef物料资料
+                var maxMtrlModdate = "";
 
                 cmd.CommandText = @"
                     SELECT MAX(MaxAmount) AS moddate
@@ -47,11 +53,11 @@ namespace JLHHJSvr.Excutor
                 {
                     if (reader.Read())
                     {
-                        maxMtrlModdate = Convert.ToDateTime(reader["moddate"]);
+                        maxMtrlModdate = Convert.ToDateTime(reader["moddate"]).ToString("yyyy-MM-dd HH:mm:ss.fff");
                     }
                 }
 
-                var mtrldefList = new List<erp_mtrldef>();
+                var mtrldefList = new List<u_mtrldef>();
 
                 var erpHelper = HelperBase.GetHelper<ERPHelper>(null);
 
@@ -60,11 +66,89 @@ namespace JLHHJSvr.Excutor
                 parameters.Add("pageindex", JToken.FromObject(0));
                 parameters.Add("pagesize", JToken.FromObject(0));
 
-                mtrldefList = erpHelper.GetERPList<erp_mtrldef>("GetL1Mtrldef", parameters);
+                mtrldefList = erpHelper.GetERPList<u_mtrldef>("GetL1Mtrldef", parameters);
+
+                if (mtrldefList.Count > 0)
+                {
+                    var outputFields =
+                        "mtrlid,mtrlcode,mtrlname,mtrlorigin,mtrltype,unit,mtrlmode,mtrlsectype,zxmtrlmode," +
+                        "fjcnt,status_config,woodcode_config,pcode_config,statustype,woodcodetype,pcodetype,scid" +
+                        ",handtype,mtrlengname,barcode,dscrp,issuliao,isuse,iflimitprice,net_weight,gross_weight,cubage,prdpackcode,opdate,opemp,moddate,lspacklimit,planprice";
+                    foreach (var mtrl in mtrldefList)
+                    {
+                        DbSqlHelper.InsertOrUpdate(cmd, mtrl, outputFields);
+                    }
+                }
+
+                rslt.mtrlnum = mtrldefList.Count;
+                #endregion
+
+                #region 同步工组资料
+                var maxWrkModdate = "";
+
+                cmd.CommandText = @"
+                    SELECT MAX(MaxAmount) AS moddate
+                    FROM (
+                        SELECT MAX(moddate) AS MaxAmount
+                        FROM u_sc_workgroup_erp
+                        UNION ALL
+                        SELECT MAX(opdate)
+                        FROM u_sc_workgroup_erp
+                    ) AS SubQuery;
+                ";
+                cmd.Parameters.Clear();
+                using (var reader = cmd.ExecuteReader())
+                {
+                    if (reader.Read())
+                    {
+                        maxWrkModdate = Convert.ToDateTime(reader["moddate"]).ToString("yyyy-MM-dd HH:mm:ss.fff");
+                    }
+                }
+
+                parameters = new JObject();
+                parameters.Add("moddate", JToken.FromObject(maxWrkModdate));
+
+                var workgroupList = erpHelper.GetERPList<u_sc_workgroup_erp>("GetSCWorkgroupList", parameters);
+
+                if (workgroupList.Count > 0)
+                {
+                    var outputFields =
+                        "wrkGrpid,wrkgrpcode,wrkGrpName,ifjj,ifprint,handtype,sonflag,parentid,inuse,storageid,opdate,opemp,moddate," +
+                        "modemp,ifwkpmtrlware,dscrp,empnum,avggz,jdtype,jdnum,tasktype,sys_changetime,userate,deptid,OTHour,shortrate," +
+                        "iflastfinish,barcode_check,ifauto_mode,ifbj,jjamt,finflowop";
+                    foreach (var item in workgroupList)
+                    {
+                        DbSqlHelper.InsertOrUpdate(cmd, item, outputFields);
+                    }
+                }
+
+                rslt.wkgnum = workgroupList.Count;
+                #endregion
 
+                #region 同步u_mtrltype物料类型
+
+                parameters = new JObject();
+
+                var mtrltypeList = erpHelper.GetERPList<u_mtrltype_erp>("GetL1Mtrltype", parameters);
+
+                if (mtrltypeList.Count > 0)
+                {
+
+                    cmd.CommandText = @"DELETE u_mtrltype_erp";
+                    cmd.Parameters.Clear();
+                    cmd.ExecuteNonQuery();
+
+                    var outputFields = "mtrltypeid,mtrltype,handtype,sonflag,parentid,mtrlprp,typecode,typecodestr";
+                    foreach (var item in mtrltypeList)
+                    {
+                        DbSqlHelper.InsertOrUpdate(cmd, item, outputFields);
+                    }
+                }
+
+                rslt.mtrltypenum = mtrltypeList.Count;
+                #endregion
 
             }
         }
-
     }
 }

+ 2 - 2
JLHHJSvr/Helper/ERPHelper.cs

@@ -301,7 +301,7 @@ namespace JLHHJSvr.Helper
 
             return scworkgroupList;
         }
-        public List<u_mtrltype> GetERPMtrltype(SqlCommand cmd)
+        public List<u_mtrltype_erp> GetERPMtrltype(SqlCommand cmd)
         {
             var selectStr = @"
                     SELECT
@@ -315,7 +315,7 @@ namespace JLHHJSvr.Helper
                         typecodestr
                     FROM u_mtrltype_erp";
             var outputFields = "mtrltypeid,mtrltype,handtype,sonflag,parentid,mtrlprp,typecode,typecodestr";
-            var mtrltypeList = new List<u_mtrltype>();
+            var mtrltypeList = new List<u_mtrltype_erp>();
             DbSqlHelper.SelectJoin(cmd, selectStr, null, null, null, outputFields, 0, 0, mtrltypeList);
 
             return mtrltypeList;