From 35bb50e0a87f0ec4dde2c5882f555d7a6c3b0fd5 Mon Sep 17 00:00:00 2001
From: zgq <519541279@qq.com>
Date: 星期二, 29 六月 2021 10:23:38 +0800
Subject: [PATCH] 新增模具其他出入库模块
---
WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 316 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 316 insertions(+), 0 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
index e00be82..5c82b3c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
@@ -68,7 +68,323 @@
}
}
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Cj_StationEntrustOutBill/AddBill")]
+ [HttpPost]
+ public object AddBill([FromBody] JObject oMain)
+ {
+ var _value = oMain["oMain"].ToString();
+ string msg1 = _value.ToString();
+ try
+ {
+ //閮ㄩ棬鍩虹璧勬枡鍙嶅簭鍒楀寲
+ msg1 = "[" + msg1.ToString() + "]";
+ 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
+ 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 = "";
+ string BillType = "3793";
+ double HWasterQty = list[0].HWasterQty;//涓嶅悎鏍兼暟閲�
+ long HPlanPieceQty = list[0].HPlanPieceQty;//鍙戝嚭浠舵暟
+ long HBadPNL = list[0].HBadPNL;//鎶ュ簾浠舵暟
+ double HPrice_BHS = list[0].HPrice_BHS;//涓嶅惈绋庡崟浠�
+ double HMoney_BHS = list[0].HMoney_BHS;//涓嶅惈绋庨噾棰�
+ double HBadCount = 0;
+ bool HLastSubProc = true;
+ double HMainSourceInterID = 0;
+ string HMainSourceBillNo = "";
+ string HMainSourceBillType = "3792";
+ 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 (HInnerBillNo == "")
+ {
+ 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 (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 (HQty <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎺ユ敹涓暟涓嶈兘灏忎簬绛変簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HWasterQty < 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "涓嶅悎鏍兼暟涓嶈兘灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HTaxRate < 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绋庣巼涓嶈兘涓鸿礋锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+ oCN.BeginTran();
+ 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_StationOutBillMain " +
+ "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
+ ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" +
+ ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+ ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" +
+ ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+ ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" +
+ ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" +
+ ") " +
+ " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
+ "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
+ "," + 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 + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount +
+ "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID +
+ ") ");
+ }
+ else if ("Modify".Equals(eventType))
+ {
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ",-1");
+ oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID + ",-1");
+ //鏇存柊涓昏〃
+ oCN.RunProc("UpDate Sc_StationOutBillMain set " +
+ " HBillNo='" + HBillNo + "'" +
+ ",HRemark='" + HRemark + "'" +
+ ",HUpDater='" + HMaker + "'" +
+ ",HUpDateDate=getdate()" +
+ ",HInnerBillNo='" + HInnerBillNo + "'" +
+ ",HSupID=" + HSupID +
+ ",HQty=" + HQty +
+ ",HPieceQty=" + HPieceQty +
+ ",HPrice=" + HPrice +
+ ",HMoney=" + HMoney +
+ ",HProcNo=" + HProcNo +
+ ",HPrice_BHS=" + HPrice_BHS +
+ ",HMoney_BHS=" + HMoney_BHS +
+ ",HTaxRate=" + HTaxRate +
+ ",HOrderProcNO='" + HOrderProcNO + "'" +
+ ",HMaterID=" + HMaterID +
+ ",HProcID=" + HProcID +
+ ",HBadPNL=" + HBadPNL +
+ ",HWasterQty=" + HWasterQty +
+ " 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_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl");
+ if (ds == null)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",1");
+ oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID.ToString() + ",1");
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ private bool AllowbillNo(string HBillNo)
+ {
+ ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+ /// <summary>
+ /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")]
+ [HttpGet]
+ public object GetStationEntrustOutBill(int HInterID)
+ {
+ try
+ {
+ ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill 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();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
//
}
--
Gitblit v1.9.1