From 5cf8e9d63d09a81d8dd01439d5bc1c619d6a2378 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期二, 17 五月 2022 16:58:42 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs | 49 ++++----
WebAPI/Models/ClsQK_PackingBill.cs | 1
WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 301 ++++++++++++++++++++++++-------------------------
3 files changed, 173 insertions(+), 178 deletions(-)
diff --git "a/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs" "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
index 98467d9..04e17a1 100644
--- "a/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
+++ "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
@@ -45,9 +45,9 @@
sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
string sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
sDay = sDay.Substring(sDay.Length - 2, 2);
- string sTMNumber ="ZX"+ sYear + sPeriod + sDay;
+ string sTMNumber = "ZX" + sYear + sPeriod + sDay;
ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
- int LSH = ClsPub.isInt(ds.Tables[0].Rows[0][0])+1; //娴佹按鍙峰姞1
+ int LSH = ClsPub.isInt(ds.Tables[0].Rows[0][0]) + 1; //娴佹按鍙峰姞1
string TM = sTMNumber + LSH;
jsn.packagebarcode = TM;
oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
@@ -55,14 +55,15 @@
}
objJsonResult.status = 0;
objJsonResult.msg = "鏌ヨ鏁版嵁鎴愬姛锛�";
- objJsonResult.data =objJsonResult.data;
+ objJsonResult.data = objJsonResult.data;
return objJsonResult;
}
catch (Exception e)
{
- objJsonResult.status =-1;
+ LogService.Write("閿欒锛�" + e.Message.ToString());
+ objJsonResult.status = -1;
objJsonResult.msg = "鐢熸垚绠辨潯鐮佸け璐ワ紒";
- objJsonResult.data =null;
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -80,7 +81,7 @@
ScanLineCode list = js.Deserialize<ScanLineCode>(msg.ToString()); //灏唈son鏁版嵁杞寲涓哄璞$被鍨嬪苟璧嬪�肩粰list
if (list.billno != "" && list.billno != null) //浠诲姟鍗曞彿锛岄潪蹇呴』锛岄潪绌哄垯鏍¢獙barcodes閲宐arcode鏄惁鐢辨浠诲姟鍗曞埗浣滅敓鎴愮殑
{
- ds = oCN.RunProcReturn("Select HBarCode barcode,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim()+"' Order by HItemID ", "Gy_BarCodeBill");
+ ds = oCN.RunProcReturn("Select HBarCode barcode,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim() + "' Order by HItemID ", "Gy_BarCodeBill");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.status = -1;
@@ -89,21 +90,21 @@
return objJsonResult;
}
List<string> NameList = (from r in ds.Tables[0].AsEnumerable() select r.Field<string>("barcode")).ToList();
- List<string> NameList1= list.barcodes.Select(t => t.barcode).ToList();
+ List<string> NameList1 = list.barcodes.Select(t => t.barcode).ToList();
var strList = NameList1.Except(NameList).ToList(); //鍒ゆ柇鎻愪氦鏁版嵁涓潯鐮佹槸鍚﹀瓨鍦ㄤ簬璁㈠崟涓�
- if (strList.Count > 0)
+ if (strList.Count > 0)
{
- string Str=String.Join(",", strList.ToArray());
+ string Str = String.Join(",", strList.ToArray());
objJsonResult.status = -1;
- objJsonResult.msg = "鏉$爜:"+ Str.ToString()+" 涓嶅寘鍚湪璁㈠崟:"+list.billno+"涓�!";
+ objJsonResult.msg = "鏉$爜:" + Str.ToString() + " 涓嶅寘鍚湪璁㈠崟:" + list.billno + "涓�!";
objJsonResult.data = null;
return objJsonResult;
- }
+ }
}
DLL.ClsSc_PackUnionBill oBill = new DLL.ClsSc_PackUnionBill();
//鍒ゆ柇绠辩爜鏄惁瀛樺湪
bool IsBarCodePack = oBill.IsBarCodePack(list.packagebarcode);
- if (IsBarCodePack == false)
+ if (IsBarCodePack == false)
{
objJsonResult.status = -1;
objJsonResult.msg = "绠辩爜宸插瓨鍦�,涓嶈兘閲嶅缁戝畾锛�";
@@ -124,7 +125,7 @@
oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
oItem.HBillType = "3783";
oItem.HBillSubType = "3783";
- oItem.HDate= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
+ oItem.HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
oItem.HBillNo = DBUtility.ClsPub.CreateBillCode(oItem.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
oItem.HBillStatus = 1;
oItem.HCheckItemNowID = 0;
@@ -146,10 +147,10 @@
oItem.HDeleteDate = "";
oItem.HICMOInterID = 0;
oItem.HICMOBillNo = "";
- oItem.HBarCode_Pack= list.packagebarcode;
+ oItem.HBarCode_Pack = list.packagebarcode;
oItem.HMaterID = 0;
oItem.HUnitID = 0;
- oItem.HUseFlag =false; //鏈夋晥鐘舵��
+ oItem.HUseFlag = false; //鏈夋晥鐘舵��
oBill.omodel = oItem;
for (int i = 0; i < list.barcodes.Count; i++)
{
@@ -164,14 +165,14 @@
}
Models.ClsSc_PackUnionBillSub oItemSub = new ClsSc_PackUnionBillSub();
ds0 = oCN.RunProcReturn("Select HBarCode,HMaterID,HUnitID,HQty,HSourceID,HGroupID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim() + "' and HBarCode='" + list.barcodes[i].barcode + "' Order by HItemID ", "Gy_BarCodeBill");
- oItemSub.HEntryID = i+1;
+ oItemSub.HEntryID = i + 1;
oItemSub.HMaterID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HMaterID"].ToString());
oItemSub.HUnitID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HUnitID"].ToString());
oItemSub.HQty = DBUtility.ClsPub.isDoule(ds0.Tables[0].Rows[0]["HQty"].ToString());
oItemSub.HSourceID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceID"].ToString());
oItemSub.HEquipID = 0;
oItemSub.HGroupID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HGroupID"].ToString());
- oItemSub.HWorkerID = 0;
+ oItemSub.HWorkerID = 0;
oItemSub.HBarCode = list.barcodes[i].barcode;
oItemSub.HBarCode_Pack = list.packagebarcode;
oItemSub.HCloseMan = "";
@@ -202,7 +203,7 @@
objJsonResult.status = 0;
objJsonResult.msg = "success";
objJsonResult.data = null;
- Log.LogSaveInfo("鎻愪氦鎴愬姛绠辨潯鐮侊細"+ list.packagebarcode); //璁板綍鎻愪氦鏁版嵁
+ Log.LogSaveInfo("鎻愪氦鎴愬姛绠辨潯鐮侊細" + list.packagebarcode); //璁板綍鎻愪氦鏁版嵁
return objJsonResult;
}
else
@@ -215,7 +216,7 @@
}
catch (Exception e)
{
- objJsonResult.status =-1;
+ objJsonResult.status = -1;
objJsonResult.msg = e.Message;
objJsonResult.data = null;
return objJsonResult;
@@ -232,7 +233,7 @@
{
//鍒ゆ柇鏄惁鍏ュ簱
ds = oCN.RunProcReturn("select * from Sc_ScanLineInStock where HBarCode_Pack='" + packagebarcode + "'", "Sc_ScanLineInStock");
- if (ds!= null && ds.Tables[0].Rows.Count>0)
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
{
objJsonResult.status = -1;
objJsonResult.msg = "璇ョ鏉$爜宸插叆搴撲笉鍏佽鍙栨秷!";
@@ -249,7 +250,7 @@
return objJsonResult;
}
ds = oCN.RunProcReturn("Select 1 from Gy_BarCodeBill where HBarCode='" + packagebarcode.ToString().Trim() + "' and HStopflag='1'", "Gy_BarCodeBill");
- if (ds != null && ds.Tables[0].Rows.Count>0)
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
{
objJsonResult.status = -1;
objJsonResult.msg = "姝ょ鏉$爜宸蹭綔搴�";
@@ -262,11 +263,11 @@
//鍒犻櫎SUM涓昏〃
oCN.RunProc("Delete From Sc_PackUnionBillSub_Sum where HBarCode_Pack='" + packagebarcode.ToString() + "'");
//鍒犻櫎瀛愯〃
- oCN.RunProc("Delete From Sc_PackUnionBillSub where HBarCode_Pack='"+ packagebarcode.ToString() + "'");
+ oCN.RunProc("Delete From Sc_PackUnionBillSub where HBarCode_Pack='" + packagebarcode.ToString() + "'");
//鍒犻櫎涓昏〃
oCN.RunProc("Delete From Sc_PackUnionBillMain where HBarCode_Pack='" + packagebarcode.ToString() + "'");
//浣滃簾鏉$爜妗f琛�
- oCN.RunProc("Update Gy_BarCodeBill set HStopflag='1' where HBarCode='"+ packagebarcode.ToString()+ "'");
+ oCN.RunProc("Update Gy_BarCodeBill set HStopflag='1' where HBarCode='" + packagebarcode.ToString() + "'");
oCN.Commit();
@@ -296,7 +297,7 @@
//string aa=list.getWeek(Convert.ToDateTime(tim));
string aa = list.GetCodeDateStr(Convert.ToDateTime(tim));
objJsonResult.status = 0;
- objJsonResult.msg =aa.ToString();
+ objJsonResult.msg = aa.ToString();
objJsonResult.data = null;
return objJsonResult;
}
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 55afaf2..363fc92 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -109,33 +109,33 @@
{
try
{
- //string sql = string.Format(@"select a.HInterID,a.HBillNo,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID, c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo
- // from Sc_ICMOBillMain a
- // left join Sc_ICMOBillSub b on a.HInterID=b.HInterID
- // left join Gy_Material m on b.HMaterID=m.HItemID
- // left join Gy_Unit u on b.HUnitID=u.HItemID
- // left join Gy_Customer c on a.HCusID=c.HItemID
- // left join Gy_Employee e on a.HEmpID=e.HItemID
- // left join Gy_Department d on a.HDeptID=d.HItemID
- // where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')");
- string sql = string.Format(@" select a.HInterID,a.HBillNo,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID,
- c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo
- ,fo.FBILLNO FBillNo,fo.F_ZZZZ_TEXT7 FLXName,fo.FRECEIVEADDRESS FInAddress,fm1.FOLDNUMBER FMaterName,fo.F_ZZZZ_TEXT FBZFS,fu.FDATAVALUE FHX,
- fu1.FDATAVALUE FQK,fo.F_ZZZZ_WBBZ FWBBZ
- from Sc_ICMOBillMain a
- left join Sc_ICMOBillSub b on a.HInterID=b.HInterID
- left join Gy_Material m on b.HMaterID=m.HItemID
- left join Gy_Unit u on b.HUnitID=u.HItemID
- left join Gy_Customer c on a.HCusID=c.HItemID
- left join Gy_Employee e on a.HEmpID=e.HItemID
- left join Gy_Department d on a.HDeptID=d.HItemID
- left join AIS20200908101915zs..T_PRD_MOENTRY f1 on b.HERPEntryID=f1.FENTRYID
- left join AIS20200908101915zs..T_SAL_ORDER fo on f1.FSaleOrderId =fo.FID
- left join AIS20200908101915zs..T_SAL_ORDERENTRY fo1 on fo.FID=fo1.FID
- left join AIS20200908101915zs..T_BD_MATERIAL fm1 on fo1.FSUBMATERIALNUMBER=fm1.FMATERIALID
- LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu1 on fo1.F_ZZZZ_ASSISTANT1=fu1.FENTRYID
- LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu on fo1.F_ZZZZ_ASSISTANT2=fu.FENTRYID
- where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')");
+ string sql = string.Format(@"select a.HInterID,a.HBillNo,b.HEntryID,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID, c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo
+ from Sc_ICMOBillMain a
+ left join Sc_ICMOBillSub b on a.HInterID=b.HInterID
+ left join Gy_Material m on b.HMaterID=m.HItemID
+ left join Gy_Unit u on b.HUnitID=u.HItemID
+ left join Gy_Customer c on a.HCusID=c.HItemID
+ left join Gy_Employee e on a.HEmpID=e.HItemID
+ left join Gy_Department d on a.HDeptID=d.HItemID
+ where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')");
+ //string sql = string.Format(@" select a.HInterID,a.HBillNo,b.HEntryID,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID,
+ // c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo
+ // ,fo.FBILLNO FBillNo,fo.F_ZZZZ_TEXT7 FLXName,fo.FRECEIVEADDRESS FInAddress,fm1.FOLDNUMBER FMaterName,fo.F_ZZZZ_TEXT FBZFS,fu.FDATAVALUE FHX,
+ // fu1.FDATAVALUE FQK,fo.F_ZZZZ_WBBZ FWBBZ
+ // from Sc_ICMOBillMain a
+ // left join Sc_ICMOBillSub b on a.HInterID=b.HInterID
+ // left join Gy_Material m on b.HMaterID=m.HItemID
+ // left join Gy_Unit u on b.HUnitID=u.HItemID
+ // left join Gy_Customer c on a.HCusID=c.HItemID
+ // left join Gy_Employee e on a.HEmpID=e.HItemID
+ // left join Gy_Department d on a.HDeptID=d.HItemID
+ // left join AIS20200908101915zs..T_PRD_MOENTRY f1 on b.HERPEntryID=f1.FENTRYID
+ // left join AIS20200908101915zs..T_SAL_ORDER fo on f1.FSaleOrderId =fo.FID
+ // left join AIS20200908101915zs..T_SAL_ORDERENTRY fo1 on fo.FID=fo1.FID
+ // left join AIS20200908101915zs..T_BD_MATERIAL fm1 on fo1.FSUBMATERIALNUMBER=fm1.FMATERIALID
+ // LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu1 on fo1.F_ZZZZ_ASSISTANT1=fu1.FENTRYID
+ // LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu on fo1.F_ZZZZ_ASSISTANT2=fu.FENTRYID
+ // where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')");
ds = oCN.RunProcReturn(sql, "Sc_ICMOBillMain");
if (ds.Tables[0].Rows.Count != 0 || ds != null)
@@ -197,81 +197,31 @@
string month = DateTime.Now.Month.ToString();
string day = DateTime.Now.Day.ToString();
string nowDate = year + month + day;
- string materid = "";
+ //string materid = "";
+ //long sum = 0;
+ //if (msg4 == "ZZ")
+ //{
+ string FID = "";
int LSH;
string LSH2;
string TM = "";
- long sum = 0;
- if (msg4 == "ZZ")
+ foreach (Models.ClsQK_PackingBill oItemSub in ls)
{
- string FID = "";
- oCN.BeginTran();
- foreach (Models.ClsQK_PackingBill oItemSub in ls)
+ //鏍规嵁鐢熸垚鏉℃暟鐢熸垚鐩稿簲鏁伴噺鏉$爜
+ for (int i = 0; i < oItemSub.HTotalQty; i++)
{
- //鏍规嵁鐢熸垚鏉℃暟鐢熸垚鐩稿簲鏁伴噺鏉$爜
- foreach (var item in oItemSub.HTotalQty.ToString())
- {
- //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
- string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate;
-
- Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
- LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
- LSH = LSH + 1;
- LSH2 = LSH.ToString();
- while (LSH2.Length<6)
- {
- LSH2 = "0" + LSH2;
- }
- TM = sTMNumber + LSH2;
- //鑾峰彇鍐呯爜
- long HInterID = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
- string str = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
- ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
- ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
- ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
- ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
- ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
- ",HGiveAwayFlag " +
- ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
- ") values ("
- + "'" + TM + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
- + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
- + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
- + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''"
- + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
- + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString()
- + ",0"
- + ",'" + oItemSub.HMaterName + "','','',0,'','')");
- oCN.RunProc(str);
- oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
- string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID);
- oCN.RunProc(sql1);
- FID = FID + HInterID + ",";
- }
- }
- oCN.Commit();
- objJsonResult.code = FID;
- objJsonResult.count = 1;
- objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- else
- {
- var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
- var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
- oCN.BeginTran();
- foreach (Models.ClsQK_PackingBill oItemSub in ls)
- {
- sum += oItemSub.HMinQty;
- materid = oItemSub.HMaterNumber;
- //鑾峰彇鍐呯爜
- long HInterID2 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
- //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+ long HInterID = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate;
Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
- LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
- //鎻掑叆鏉$爜妗f
+ LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//
+ LSH = LSH + 1;
+ LSH2 = LSH.ToString();
+ while (LSH2.Length < 6)
+ {
+ LSH2 = "0" + LSH2;
+ }
+ TM = sTMNumber + LSH2;
+ //鑾峰彇鍐呯爜
oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -281,76 +231,119 @@
",HGiveAwayFlag " +
",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
") values ("
- + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
+ + "'" + TM + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
+ ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
+ ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
+ ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''"
+ ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
- + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID2.ToString()
+ + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString()
+ ",0"
+ ",'" + oItemSub.HMaterName + "','','',0,'','')");
- //鎻掑叆缁勬墭鍗曞瓙琛�
- string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark,
- HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,
- HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID,
- HScanDate,HBarCode,HBarCode_Pack)
- values(" + HInterID + ",'','',0,'鑷姩缁戝畾'," + oItemSub.HInterID + ",'','" + oItemSub.HBillNo + "','3710'," +
- "0,0," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HPlanQty + ", 0,0,0,0," +
- "getdate(),'" + LSH + "','" + HBillNo + "')");
- //鏇存敼鐢熶骇璁㈠崟鐨勬暟閲�
- string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID);
-
- oCN.RunProc(sql);
- oCN.RunProc(sql1);
+ oCN.RunProc("update Sc_ICMOBillSub set HQty=" + (oItemSub.HPlanQty- oItemSub.HMinQty).ToString() + " where HEntryID=" + oItemSub.HEntryID);
+ oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ FID = FID + HInterID + ",";
}
- //鐢熸垚缁勬墭鍗曚富琛�
- string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
- HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo,
- HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
- HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
- values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
- "'鑷姩缁戝畾','','', '" + msg3 + "',getdate(),'','',0,'',0,0,'" +
- HBillNo + "',0,0,0,0,0," +
- "0,0,0,0,0,'','','')");
- oCN.RunProc(sql2);
- //鍐嶆鐢熸垚鍞竴鐮�
- //鑾峰彇鍐呯爜
- long HInterID3 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
- //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
- string sTMNumber1 = OrgNum + materid + nowDate;
- Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber1 + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
- int LSH1 = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
- string sql3 = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
- ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
- ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
- ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
- ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
- ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
- ",HGiveAwayFlag " +
- ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
- ") values ("
- + "'" + LSH1 + "','鍞竴鏉$爜','" + materid.ToString() + "',0," + sum.ToString()
- + ",'',0,0,'" + msg3 + "',getdate(),0," + sum.ToString()
- + ", 0,0,'" + HBillNo + "','3710','',"
- + sum.ToString() + "," + HInterID.ToString() + ",0,0,0,''"
- + ",0,'',getdate(),'',getdate()"
- + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID3.ToString()
- + ",0"
- + ",'','','',0,'','')");
-
- oCN.RunProc(sql3);
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鎷艰鐢熸垚鎴愬姛";
- objJsonResult.data = null;
- return objJsonResult;
}
+ objJsonResult.code = FID;
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ //}
+ //else
+ //{
+ // var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
+ // var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
+ // oCN.BeginTran();
+ // foreach (Models.ClsQK_PackingBill oItemSub in ls)
+ // {
+ // sum += oItemSub.HMinQty;
+ // materid = oItemSub.HMaterNumber;
+ // //鑾峰彇鍐呯爜
+ // long HInterID2 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+ // //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+ // string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate;
+ // Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ // LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
+ // //鎻掑叆鏉$爜妗f
+ // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+ // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ // ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+ // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+ // ",HGiveAwayFlag " +
+ // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+ // ") values ("
+ // + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
+ // + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
+ // + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
+ // + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''"
+ // + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
+ // + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID2.ToString()
+ // + ",0"
+ // + ",'" + oItemSub.HMaterName + "','','',0,'','')");
+ // //鎻掑叆缁勬墭鍗曞瓙琛�
+ // string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark,
+ // HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,
+ // HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID,
+ // HScanDate,HBarCode,HBarCode_Pack)
+ // values(" + HInterID + ",'','',0,'鑷姩缁戝畾'," + oItemSub.HInterID + ",'','" + oItemSub.HBillNo + "','3710'," +
+ // "0,0," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HPlanQty + ", 0,0,0,0," +
+ // "getdate(),'" + LSH + "','" + HBillNo + "')");
+ // //鏇存敼鐢熶骇璁㈠崟鐨勬暟閲�
+ // string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID);
+
+ // oCN.RunProc(sql);
+ // oCN.RunProc(sql1);
+ // }
+ // //鐢熸垚缁勬墭鍗曚富琛�
+ // string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
+ // HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo,
+ // HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
+ // HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
+ // values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
+ // "'鑷姩缁戝畾','','', '" + msg3 + "',getdate(),'','',0,'',0,0,'" +
+ // HBillNo + "',0,0,0,0,0," +
+ // "0,0,0,0,0,'','','')");
+ // oCN.RunProc(sql2);
+ // //鍐嶆鐢熸垚鍞竴鐮�
+ // //鑾峰彇鍐呯爜
+ // long HInterID3 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+ // //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+ // string sTMNumber1 = OrgNum + materid + nowDate;
+ // Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber1 + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ // int LSH1 = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
+ // string sql3 = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+ // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ // ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+ // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+ // ",HGiveAwayFlag " +
+ // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+ // ") values ("
+ // + "'" + LSH1 + "','鍞竴鏉$爜','" + materid.ToString() + "',0," + sum.ToString()
+ // + ",'',0,0,'" + msg3 + "',getdate(),0," + sum.ToString()
+ // + ", 0,0,'" + HBillNo + "','3710','',"
+ // + sum.ToString() + "," + HInterID.ToString() + ",0,0,0,''"
+ // + ",0,'',getdate(),'',getdate()"
+ // + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID3.ToString()
+ // + ",0"
+ // + ",'','','',0,'','')");
+
+ // oCN.RunProc(sql3);
+ // oCN.Commit();
+ // objJsonResult.code = "1";
+ // objJsonResult.count = 1;
+ // objJsonResult.Message = "鎷艰鐢熸垚鎴愬姛";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
}
catch (Exception e)
{
- oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "鑾峰彇澶辫触锛�" + e.ToString();
@@ -538,6 +531,6 @@
}
#endregion
-
+
}
}
\ No newline at end of file
diff --git a/WebAPI/Models/ClsQK_PackingBill.cs b/WebAPI/Models/ClsQK_PackingBill.cs
index f4597d3..27c273e 100644
--- a/WebAPI/Models/ClsQK_PackingBill.cs
+++ b/WebAPI/Models/ClsQK_PackingBill.cs
@@ -24,6 +24,7 @@
public string HDeptName;
public string HPlanEndDate;
public Int64 HInterID;
+ public Int64 HEntryID;
public string HBillNo;
public string HSeOrderBillNo;
public string FBillNo;
--
Gitblit v1.9.1