From dfe8c5343eefa07dffe6b07981c179cb72c6b9cb Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期四, 23 三月 2023 15:55:59 +0800
Subject: [PATCH] nothing
---
VueWebApi/DLL/DAL/AppPurchManagementDAL.cs | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 151 insertions(+), 15 deletions(-)
diff --git a/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs b/VueWebApi/DLL/DAL/AppPurchManagementDAL.cs
index 3d116af..3d6c562 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,19 +170,20 @@
for (int i = 0; i < json.Count; i++)
{
//鍐欏叆閲囪喘鍒拌揣鍗曞瓙琛�
- sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,hpartcode,hplanqty,hqty,hacceptdate,hischeck,hbatchno)
- values(@hbillno,@hpartcode,@hplanqty,@hqty,@hacceptdate,@hischeck,@hbatchno)";
+ sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,rownumber,hpartcode,hplanqty,hqty,hacceptdate,hcheckstaus,hbatchno)
+ values(@hbillno,@rownumber,@hpartcode,@hplanqty,@hqty,@hacceptdate,@hcheckstaus,@hbatchno)";
list.Add(new
{
str = sql,
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),
- hischeck = json[i].hischeck,
+ hacceptdate = hacceptdate == "" ? null : hacceptdate,
+ hcheckstaus = 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,13 +212,14 @@
hdeptcode = dpartment,
hsourcebillno = purordercode,
hsourcebilltype = "1102",
+ barcodeposition="2060;閲囪喘鍒拌揣",
lm_user = username,
lm_date = DateTime.Now.ToString()
}
});
}
//鏇存柊閲囪喘璁㈠崟瀛愯〃锛氱疮璁″埌璐ф暟閲�
- sql = @"update T_PurchaseOrder_sub set countarrivalquantity=countarrivalquantity+@hqty where ordercode=@purordercode and materiel_code=@materiel_code and rownumber=@rownumber";
+ sql = @"update T_PurchaseOrder_sub set countarrivalquantity=countarrivalquantity+@hqty where purchaseorder_code=@purordercode and materiel_code=@materiel_code and rownumber=@rownumber";
list.Add(new
{
str = sql,
@@ -231,7 +233,7 @@
});
}
//鏇存柊閲囪喘璁㈠崟涓昏〃锛氳鍗曠姸鎬�
- sql = @"update T_PurchaseOrder set status=@status where ordercode=@purordercode";
+ sql = @"update T_PurchaseOrder set status=@status where ordercode=@ordercode";
list.Add(new
{
str = sql,
@@ -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