From 6e1231595e0e72b0fa421711d34bc77d3b406a4b Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 21 四月 2023 10:14:37 +0800
Subject: [PATCH] 高级排程过工单信息测试接口(实现不了) 采购到货单接口开发

---
 VueWebApi/DLL/DAL/PurchaseOrderDAL.cs |  184 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 184 insertions(+), 0 deletions(-)

diff --git a/VueWebApi/DLL/DAL/PurchaseOrderDAL.cs b/VueWebApi/DLL/DAL/PurchaseOrderDAL.cs
index ce53afb..e905881 100644
--- a/VueWebApi/DLL/DAL/PurchaseOrderDAL.cs
+++ b/VueWebApi/DLL/DAL/PurchaseOrderDAL.cs
@@ -311,5 +311,189 @@
             return mes;
         }
         #endregion
+
+
+
+        #region[閲囪喘鍒拌揣鍗曟煡璇
+        public static ToMessage PurchaseArrivalOrderSearch(string orderstatus, string mesordercode, string departmentcode, string customercode, string orderdateopendate, string orderdateclosedate, string sourceorder, string creatuser, string arrivalopendate, string arrivalclosedate, int startNum, int endNum, string prop, string order)
+        {
+            var dynamicParams = new DynamicParameters();
+            string search = "";
+            try
+            {
+                if (orderstatus != "" && orderstatus != null)
+                {
+                    search += "and A.hbillstaus=@orderstatus ";
+                    dynamicParams.Add("@orderstatus", orderstatus);
+                }
+                if (mesordercode != "" && mesordercode != null)
+                {
+                    search += "and A.hbillno like '%'+@mesordercode+'%' ";
+                    dynamicParams.Add("@mesordercode", mesordercode);
+                }
+                if (departmentcode != "" && departmentcode != null)
+                {
+                    search += "and A.hdepartmentcode=@departmentcode ";
+                    dynamicParams.Add("@departmentcode", departmentcode);
+                }
+                if (customercode != "" && customercode != null)
+                {
+                    search += "and A.hcustomercode=@customercode ";
+                    dynamicParams.Add("@customercode", customercode);
+                }
+                if (sourceorder != "" && sourceorder != null)
+                {
+                    search += "and A.hsourcebillno like '%'+@sourceorder+'%' ";
+                    dynamicParams.Add("@sourceorder", sourceorder);
+                }
+                if (orderdateopendate != "" && orderdateopendate != null)
+                {
+                    search += "and A.hdate between @orderdateopendate and @orderdateclosedate ";
+                    dynamicParams.Add("@orderdateopendate", orderdateopendate + " 00:00:00");
+                    dynamicParams.Add("@orderdateclosedate", orderdateclosedate + " 23:59:59");
+                }
+                if (creatuser != "" && creatuser != null)
+                {
+                    search += "and A.lm_user like '%'+@creatuser+'%' ";
+                    dynamicParams.Add("@creatuser", creatuser);
+                }
+                if (arrivalopendate != "" && arrivalopendate != null)
+                {
+                    search += "and A.hacceptdate between @arrivalopendate and @arrivalclosedate ";
+                    dynamicParams.Add("@arrivalopendate", arrivalopendate + " 00:00:00");
+                    dynamicParams.Add("@arrivalclosedate", arrivalclosedate + " 23:59:59");
+                }
+                if (search == "")
+                {
+                    search = "and 1=1 ";
+                }
+                // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+                var total = 0; //鎬绘潯鏁�
+                var sql = @"select A.hbillstaus,A.hdate,A.hbillno,A.hdepartmentcode,T.org_name as hdepartmentname,A.hcustomercode,C.name as hcustomername,
+                            A.hsourcebillno,A.hacceptdate,A.lm_user as usercode,U.username
+                            from T_PurchaseArrivalOrder A
+                            left join TCustomer C on A.hcustomercode=C.code 
+                            left join TOrganization T on A.hdepartmentcode=T.org_code
+                            left join TUser U on A.lm_user=U.usercode
+                            where  1=1 " + search;
+                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.count = total;
+                mes.data = data.ToList();
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閲囪喘鍒拌揣鍗曟槑缁哴
+        public static ToMessage PurchaseArrivalOrderSubSearch(string arrivelodercode)
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鑾峰彇閲囪喘鍒拌揣鍗曠墿鏂欎俊鎭�
+                sql = @"select  S.hpartcode as partcode,M.partname,M.partspec,M.uom_code,T.name as uom_name,
+                        S.hqty,S.hqty,S.hreturnqty,S.hacceptdate,S.hstorehousecode,K.name as hstorehousename,S.hcheckstaus
+                        from T_PurchaseArrivalOrder A
+                        left join T_PurchaseArrivalOrder_sub S on A.hbillno=S.hbillno
+                        left join TMateriel_Info M on S.hpartcode=M.partcode
+                        left join TUom T on M.uom_code=T.code
+                        left join T_Sec_Stck K on S.hstorehousecode=K.code
+                        where A.hbillno=@arrivelodercode";
+                dynamicParams.Add("@arrivelodercode", arrivelodercode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閲囪喘鍒拌揣鍗曞叧闂璢
+        public static ToMessage ClosedPurchaseArrivalOrder(string arrivelodercode, string username)
+        {
+            var sql = "";
+            List<object> list = new List<object>();
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鏇存柊鍒拌揣鍗曠姸鎬�
+                sql = @"update T_PurchaseArrivalOrder set hbillstaus='CLOSED'  where hbillno=@arrivelodercode";
+                list.Add(new { str = sql, parm = new { arrivelodercode = arrivelodercode } });
+                bool aa = DapperHelper.DoTransaction(list);
+                if (aa)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鎿嶄綔鎴愬姛!";
+                    mes.data = null;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    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 PurchaseArrivalOrderSubLabDetails(string sourceorder, string arrivelodercode, string partcode)
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鑾峰彇鍒拌揣鐗╂枡瀵瑰簲鏍囩淇℃伅
+                sql = @"select C.hbarcode,A.hbillno,A.hsourcebillno,C.qualitystatus,C.hqty,C.hbatchno   
+                        from T_PurchaseArrivalOrder A
+                        inner join T_PurchaseArrivalOrder_sub B on A.hbillno=B.hbillno
+                        left  join  T_BarCodeBill C on A.hsourcebillno=C.hsourcebillno and A.hbillno=C.hbillno and B.hpartcode=C.hmaterialcode
+                        where A.hsourcebillno=@hsourcebillno and A.hbillno=@hbillno and B.hpartcode=@hpartcode";
+                dynamicParams.Add("@hsourcebillno", sourceorder);
+                dynamicParams.Add("@hbillno", arrivelodercode);
+                dynamicParams.Add("@hpartcode", partcode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            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