From e235d94e5987d43117439837e3a0ee2e316e91d2 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 22 三月 2023 17:19:00 +0800
Subject: [PATCH] 获取标签接口修改、过滤器修改、用户清单导入班组字段

---
 VueWebApi/DLL/DAL/AppPurchManagementDAL.cs |  158 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 147 insertions(+), 11 deletions(-)

diff --git a/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs b/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs
index 3d116af..3b05d98 100644
--- a/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs
@@ -70,7 +70,7 @@
             try
             {
                 //鏍规嵁閲囪喘璁㈠崟鍙锋煡璇㈢墿鏂欎俊鎭紝渚涘簲鍟嗕俊鎭�
-                sql = @"select B.rownumber, B.materiel_code as partcode,M.partname,M.partspec,M.is_batchno,
+                sql = @"select B.rownumber, B.materiel_code as partcode,M.partname,M.partspec,M.is_batchno,M.is_incheck,
                         B.quantity,B.customercode,C.name as customername,A.departmentcode,T.org_name as departmentname,U.code as uomcode,U.name as uomname,
                         A.ordercode,B.countarrivalquantity,A.acceptdate  
                         from T_PurchaseOrder A
@@ -143,10 +143,10 @@
                     mes.data = null;
                     return mes;
                 }
-                //Lambda琛ㄨ揪寮忚繃婊よ幏鍙栭璁″埌璐ф棩鏈熴�侀儴闂ㄣ�佷緵搴斿晢
-                string hacceptdate = json.Select(p => p.hacceptdate).ToList().Distinct().ToString(); //棰勮鍒拌揣鏃ユ湡
-                string dpartment = json.Select(p => p.hdepartmentcode).ToList().Distinct().ToString(); //閮ㄩ棬
-                string customercode = json.Select(p => p.hcustomercode).ToList().Distinct().ToString(); //渚涘簲鍟�
+                //Lambda琛ㄨ揪寮忚繃婊よ幏鍙栭璁″埌璐ф棩鏈熴�侀儴闂ㄣ�佷緵搴斿晢鍙栫涓�涓�
+                string hacceptdate = json.Select(p => p.hacceptdate).Distinct().ToList().First().ToString(); //棰勮鍒拌揣鏃ユ湡
+                string dpartment = json.Select(p => p.hdepartmentcode).Distinct().ToList().First().ToString(); //閮ㄩ棬
+                string customercode = json.Select(p => p.hcustomercode).Distinct().ToList().First().ToString(); //渚涘簲鍟�
                 //鍐欏叆閲囪喘鍒拌揣鍗曚富琛�
                 sql = @"insert into T_PurchaseArrivalOrder(hbillno,hdate,hacceptdate,hbillstaus,hdepartmentcode,hcustomercode,hsourcebillno,lm_user,lm_date) 
                         values(@hbillno,@hdate,@hacceptdate,@hbillstaus,@hdepartmentcode,@hcustomercode,@hsourcebillno,@lm_user,@lm_date)";
@@ -157,7 +157,7 @@
                     {
                         hbillno = djwo,
                         hdate = DateTime.Now.ToString(),
-                        hacceptdate = Convert.ToDateTime(hacceptdate),
+                        hacceptdate =hacceptdate==""?null:hacceptdate,
                         hbillstaus = orderstaus,
                         hdepartmentcode = dpartment,
                         hcustomercode = customercode,
@@ -170,7 +170,7 @@
                 for (int i = 0; i < json.Count; i++)
                 {
                     //鍐欏叆閲囪喘鍒拌揣鍗曞瓙琛�
-                    sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,hpartcode,hplanqty,hqty,hacceptdate,hischeck,hbatchno) 
+                    sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,rownumber,hpartcode,hplanqty,hqty,hacceptdate,hischeck,hbatchno) 
                         values(@hbillno,@hpartcode,@hplanqty,@hqty,@hacceptdate,@hischeck,@hbatchno)";
                     list.Add(new
                     {
@@ -178,10 +178,11 @@
                         parm = new
                         {
                             hbillno = djwo,
+                            rownumber=json[i].rownumber,
                             hpartcode = json[i].hpartcode,
                             hplanqty = decimal.Parse(json[i].hplanqty),
                             hqty = decimal.Parse(json[i].hqty),
-                            hacceptdate = Convert.ToDateTime(hacceptdate),
+                            hacceptdate = hacceptdate == "" ? null : hacceptdate,
                             hischeck = json[i].hischeck,
                             hbatchno = json[i].hbatchno
                         }
@@ -191,8 +192,8 @@
                     for (int j = 0; j < json[i].children.Count; j++)
                     {
                         //鍐欏叆鏉$爜妗f琛�
-                        sql = @"insert into T_BarCodeBill(rightcode,hbillno,hbilltype,hbarcode,hbarcodestatus,hbarcodetype,hmaterialcode,hqty,hbatchno,hcustomercode,hdeptcode,hsourcebillno,hsourcebilltype,lm_user,lm_date) 
-                        values(@rightcode,hbillno,@hbilltype,@hbarcode,@hbarcodestatus,@hbarcodetype,@hmaterialcode,@hqty,@hbatchno,@hcustomercode,@hdeptcode,@hsourcebillno,@hsourcebilltype,@lm_user,@lm_date)";
+                        sql = @"insert into T_BarCodeBill(rightcode,hbillno,hbilltype,hbarcode,hbarcodestatus,hbarcodetype,hmaterialcode,hqty,hbatchno,hcustomercode,hdeptcode,hsourcebillno,hsourcebilltype,barcodeposition,lm_user,lm_date) 
+                        values(@rightcode,hbillno,@hbilltype,@hbarcode,@hbarcodestatus,@hbarcodetype,@hmaterialcode,@hqty,@hbatchno,@hcustomercode,@hdeptcode,@hsourcebillno,@hsourcebilltype,@barcodeposition,@lm_user,@lm_date)";
                         list.Add(new
                         {
                             str = sql,
@@ -211,6 +212,7 @@
                                 hdeptcode = dpartment,
                                 hsourcebillno = purordercode,
                                 hsourcebilltype = "1102",
+                                barcodeposition="2060;閲囪喘鍒拌揣",
                                 lm_user = username,
                                 lm_date = DateTime.Now.ToString()
                             }
@@ -247,7 +249,7 @@
                     mes.code = "200";
                     mes.count = 0;
                     mes.Message = "閲囪喘鍒拌揣鎴愬姛!";
-                    mes.data = null;
+                    mes.data = djwo;
                 }
                 else
                 {
@@ -267,5 +269,139 @@
             return mes;
         }
         #endregion
+
+
+        #region[閲囪喘鍏ュ簱閫夋嫨鏈夊埌璐ч噰璐鍗昡
+        public static ToMessage MesAppPurchInStorSelectCGOrder()
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鏈夊埌璐ф垨鑰呴儴鍒嗗叆搴撶殑閲囪喘璁㈠崟
+                sql = @"select distinct A.ordercode   from T_PurchaseOrder A
+                        inner join T_PurchaseArrivalOrder B on A.ordercode=B.hsourcebillno
+                        where B.hbillstaus in('BINARIVE','INARIVE','BINSTOG')";
+                var data = DapperHelper.selecttable(sql);
+                if (data.Rows.Count > 0)
+                {
+                    mes.code = "200";
+                    mes.Message = "success!";
+                    mes.data = data;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.Message = "鏃犲彲鎵ц璁㈠崟!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閫夋嫨閲囪喘璁㈠崟甯﹀嚭璁㈠崟涓嬫湁鍒拌揣鐨勭墿鏂欎俊鎭痌
+        public static ToMessage MesAppPurchInStorSelectCGOrderPart(string ordercode)
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //閫夋嫨閲囪喘璁㈠崟甯﹀嚭璁㈠崟涓嬫湁鍒拌揣鐨勭墿鏂欎俊鎭�
+                sql = @"select A.ordercode,M.partcode,M.partname,M.partspec,avg(S.hplanqty) as hplanqty,sum(S.hqty) as hqty 
+                        from T_PurchaseOrder A
+                        inner join T_PurchaseArrivalOrder B on A.ordercode=B.hsourcebillno
+                        inner join T_PurchaseArrivalOrder_sub S on B.hbillno=S.hbillno
+                        left  join TMateriel_Info M on S.hpartcode=M.partcode
+                        where B.hbillstaus in('BINARIVE','INARIVE','BINSTOG') and A.ordercode=@ordercode
+                        group by A.ordercode,M.partcode,M.partname,M.partspec";
+                dynamicParams.Add("@ordercode", ordercode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                if (data.Rows.Count > 0)
+                {
+                    mes.code = "200";
+                    mes.Message = "success!";
+                    mes.data = data;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.Message = "褰撳墠璁㈠崟鏃犲彲鎵ц鐗╂枡!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閲囪喘鍏ュ簱鎵弿鏍囩鏉$爜甯﹀嚭鍒拌揣鍗曚俊鎭痌
+        public static ToMessage MesAppPurchInStorScanLabCode(string labcode,string ordercode)
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鍒ゆ柇鏉$爜鐘舵��
+                mes = LabCodeStatusMessage.LabCodeStatus("2060", "1103",labcode);//鍔熻兘缂栧彿銆佸崟鎹被鍨嬬紪鐮併�佹爣绛剧紪鐮�
+                if (mes.code == "300") 
+                {
+                    return mes;
+                }
+                //鍒ゆ柇鎵弿鏍囩鏄惁涓哄綋鍓嶉�夋嫨閲囪喘璁㈠崟涓嬬殑鍒拌揣鍗曟墍鐢熸垚鏍囩
+                sql = @"select *   from T_BarCodeBill where hsourcebillno=@ordercode";
+                dynamicParams.Add("@ordercode", ordercode);
+                var data0 = DapperHelper.selectdata(sql, dynamicParams);
+                if (data0.Rows.Count < 0) 
+                {
+                    mes.code = "300";
+                    mes.Message = "褰撳墠鏉$爜涓嶆槸閲囪喘璁㈠崟銆�"+ ordercode + "銆戠敓鎴愭潯鐮�!";
+                    mes.data = null;
+                    return mes;
+                }
+                //鏍规嵁鏍囩鏉$爜鏌ヨ鍒拌揣鐢熸垚鐨勬爣绛句俊鎭�
+                sql = @"select A.hbarcode,A.hbillno,A.hqty,A.hcustomercode,C.name as hcustomername,A.hbatchno,A.qualitystatus   
+                        from T_BarCodeBill A
+                        left join TCustomer C on A.hcustomercode=C.code
+                        where A.hbarcode=@labcode";
+                dynamicParams.Add("@labcode", labcode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                if (data.Rows.Count > 0)
+                {
+                    mes.code = "200";
+                    mes.Message = "success!";
+                    mes.data = data;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.Message = "鏍囩淇℃伅涓嶅瓨鍦�!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3