From 2c9c63c19194fba07de27f4806c500a04e3486c2 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期二, 13 七月 2021 17:08:35 +0800
Subject: [PATCH] nothing
---
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs | 291 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 227 insertions(+), 64 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index c241315..5caf37a 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -69,7 +69,7 @@
}
/// <summary>
- /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭�
+ /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭紙濮斿宸ュ簭鎺ユ敹銆佸伐搴忚繘绔欐帴鏀堕�氱敤锛�
///鍙傛暟锛歴tring sql銆�
///杩斿洖鍊硷細object銆�
/// </summary>
@@ -138,70 +138,180 @@
{
//濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲
msg1 = "[" + msg1.ToString() + "]";
- List<StationEntrustInBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationEntrustInBill>>(msg1);
-
- var HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
- var HYear = 2021;
- var HPeriod = list[0].HPeriod;//鍗曚环
- var HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
- var HBillStatus = 0;
- var HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿
- var HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙�
- long HICMOInterID = DBUtility.ClsPub.isLong(list[0].HICMOInterID);//鐢熶骇璁㈠崟鍙稩D
- var HProcExchInterID = 0;
- var HProcExchEntryID = 0;
- var HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗�
- var HProcID = list[0].HProcID;//褰撳墠宸ュ簭
- var HMaterID = list[0].HMaterID;//浜у搧ID
- var HStationInTime = list[0].HStationInTime;//
- var HEmpID = list[0].HEmpID;//鎿嶄綔鍛業D
- var HSourceID = list[0].HSourceID;//鐢熶骇璧勬簮ID
- var HGroupID = list[0].HGroupID;//鐝粍ID
- var HICMOQty = list[0].HICMOQty;//浠诲姟鍗曟暟閲�
- var HPlanQty = list[0].HPlanQty;//娴佽浆鍗℃暟閲�
- var HQty = list[0].HQty;//鍙戝嚭鏁伴噺
- var HSupID = list[0].HSupID;//渚涘簲鍟咺D
- var HPieceQty = list[0].HPieceQty;//鍙戝嚭浠舵暟
- var HSourceName = list[0].HSourceName;//
- var HPrice = list[0].HPrice;//鍗曚环
- var HMoney = list[0].HMoney;//閲戦
- var HRemark = list[0].HRemark;//澶囨敞
- var HTaxRate = list[0].HTaxRate;//绋庣巼
- var HProcNo = list[0].HProcNo;//娴佹按鍙�
- var HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
- var HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
- var HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
- var HWWWorkOrderBillNo = list[0].HWWWorkOrderBillNo;//濮斿宸ュ崟鍙�
- var HMaker = list[0].HMaker;//鍒跺崟浜�
- var HProcPlanInterID = 0;
- var HProcPlanEntryID = 0;
- var HProcPlanBillNo = "";
- var HDeptID = list[0].HDeptID;//閮ㄩ棬ID
- var HBarCode = list[0].HBarCode;//鏉″舰鐮�
- var HAddr = "";
- var HBarCodeMaker = "";
-
+ List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1);
+ string eventType = list[0].eventType;
+ long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+ int HYear = 2021;
+ double HPeriod = list[0].HPeriod;//鍗曚环
+ string HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+ int HBillStatus = 0;
+ string HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿
+ string HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙�
+ long HICMOInterID = list[0].HICMOInterID;//鐢熶骇璁㈠崟鍙稩D
+ long HProcExchInterID = list[0].lngBillKey;
+ long HProcExchEntryID = list[0].lngBillSubKey;
+ string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗�
+ long HProcID = list[0].HProcID;//褰撳墠宸ュ簭
+ long HMaterID = list[0].HMaterID;//浜у搧ID
+ DateTime HStationInTime = list[0].HStationInTime;//
+ long HEmpID = list[0].HEmpID;//鎿嶄綔鍛業D
+ long HSourceID = list[0].HSourceID;//鐢熶骇璧勬簮ID
+ long HGroupID = list[0].HGroupID;//鐝粍ID
+ double HICMOQty = list[0].HICMOQty;//浠诲姟鍗曟暟閲�
+ double HPlanQty = list[0].HPlanQty;//娴佽浆鍗℃暟閲�
+ double HQty = list[0].HQty;//鍙戝嚭鏁伴噺
+ long HSupID = list[0].HSupID;//渚涘簲鍟咺D
+ double HPieceQty = list[0].HPieceQty;//鍙戝嚭浠舵暟
+ string HSourceName = list[0].HSourceName;//
+ double HPrice = list[0].HPrice;//鍗曚环
+ double HMoney = list[0].HMoney;//閲戦
+ string HRemark = list[0].HRemark;//澶囨敞
+ double HTaxRate = list[0].HTaxRate;//绋庣巼
+ long HProcNo = list[0].HProcNo;//娴佹按鍙�
+ string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
+ int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
+ int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
+ string HWWWorkOrderBillNo = list[0].HWWWorkOrderBillNo;//濮斿宸ュ崟鍙�
+ string HMaker = list[0].HMaker;//鍒跺崟浜�
+ int HProcPlanInterID = 0;
+ int HProcPlanEntryID = 0;
+ string HProcPlanBillNo = "";
+ long HDeptID = list[0].HDeptID;//閮ㄩ棬ID
+ string HBarCode = list[0].HBarCode;//鏉″舰鐮�
+ string HAddr = "";
+ string HBarCodeMaker = "";
+ if (HProcExchInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HProcExchEntryID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娴佹按鍙�2娌℃湁閫夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HProcNo <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HProcExchBillNo == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HMaterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HSupID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "渚涘簲鍟嗘病鏈夐�夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HProcID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HQty <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙戝嚭鏁伴噺涓嶈兘涓�0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
oCN.BeginTran();
- //涓昏〃
- oCN.RunProc("Insert Into Sc_StationInBillMain " +
- "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
- ",HYear,HPeriod,HRemark,HInnerBillNo" +
- ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
- ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
- ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
- ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" +
- ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" +
- ") " +
- " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "'," + HBillStatus.ToString() + ",getdate(),'" + HMaker + "',getdate()" +
- "," + HYear.ToString() + "," + HPeriod.ToString() + ",'" + HRemark + "','" + HInnerBillNo + "'" +
- "," + HICMOInterID.ToString() + ",'" + HICMOBillNo + "'," + HProcPlanInterID.ToString() + "," + HProcPlanEntryID.ToString() + ",'" + HProcPlanBillNo + "'," + HProcExchInterID.ToString() + "," + HProcExchEntryID.ToString() +
- ",'" + HProcExchBillNo + "'," + HMaterID.ToString() + "," + HProcID.ToString() + "," + HICMOQty.ToString() + "," + HPlanQty.ToString() + ",getdate()," + HSourceID.ToString() +
- "," + HGroupID.ToString() + "," + HDeptID.ToString() + "," + HEmpID.ToString() + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
- "," + HSupID.ToString() + "," + HTaxRate.ToString() + "," + HQty.ToString() + "," + HPrice.ToString() + "," + HMoney.ToString() + "," + HPieceQty.ToString() +
- "," + HProcNo.ToString() + ",'" + HOrderProcNO.ToString() + "'" + ",'" + HWWWorkOrderBillNo.ToString() + "'" + "," + HWWWorkOrderInterID.ToString() + "" + "," + HWWWorkOrderEntryID.ToString() + "" +
- ") ");
- ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_QtyCtrl " + HInterID.ToString() + "", "h_p_MES_StationInBill_QtyCtrl");
+ if ("Add".Equals(eventType))
+ {
+ if (!AllowbillNo(HBillNo))
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //涓昏〃
+ oCN.RunProc("Insert Into Sc_StationInBillMain " +
+ "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
+ ",HYear,HPeriod,HRemark,HInnerBillNo" +
+ ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+ ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
+ ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+ ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" +
+ ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" +
+ ") " +
+ " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" +
+ ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" +
+ "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID +
+ ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
+ "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
+ "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty +
+ ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "" +
+ ") ");
+ }
+ else if ("Modify".Equals(eventType))
+ {
+
+ //鍒犻櫎鍏宠仈
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID + ",-1");
+ oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_In " + HInterID + ",-1");
+
+ //鏇存柊涓昏〃
+ oCN.RunProc("UpDate Sc_StationInBillMain set " +
+ "HBillNo='" + HBillNo + "'" +
+ ",HRemark='" + HRemark + "'" +
+ ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+ ",HUpDateDate=getdate()" +
+ ",HInnerBillNo='" + HInnerBillNo + "'" +
+ ",HSupID=" + HSupID +
+ ",HQty=" + HQty +
+ ",HPieceQty=" + HPieceQty +
+ ",HPrice=" + HPrice +
+ ",HMoney=" + HMoney +
+ ",HTaxRate=" + HTaxRate +
+ ",HMaterID=" + HMaterID +
+ ",HProcID=" + HProcID +
+ ",HProcNo=" + HProcNo +
+ ",HOrderProcNO='" + HOrderProcNO + "'" +
+ " where HInterID=" + HInterID);
+ }
+ else
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_QtyCtrl " + HInterID + "", "h_p_MES_StationInBill_QtyCtrl");
if (ds == null)
{
oCN.RollBack();
@@ -240,7 +350,55 @@
}
catch (Exception e)
{
- oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ private bool AllowbillNo(string HBillNo)
+ {
+ ds = oCN.RunProcReturn("select HBillNo from Sc_StationInBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationInBillMain");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Cj_StationEntrustInBill/GetStationEntrustInBill")]
+ [HttpGet]
+ public object GetStationEntrustInBill(int HInterID)
+ {
+ try
+ {
+ ds = oCN.RunProcReturn("select * from h_v_GetStationInBill where HInterID = " + HInterID, "h_v_GetStationOutBill");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "濮斿宸ュ簭鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception锛�" + e.ToString();
@@ -248,5 +406,10 @@
return objJsonResult;
}
}
+
+
+
+
+ //
}
}
\ No newline at end of file
--
Gitblit v1.9.1