From 30091220a09acb060269784dbee1a3ab799bc663 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期二, 07 二月 2023 17:39:03 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 293 insertions(+), 2 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
index 35d43ef..00aa89a 100644
--- a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -13,6 +14,8 @@
//鐢熶骇姹囨姤Controller
public class Sc_ICMOReportBillController : ApiController
{
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
private json objJsonResult = new json();
@@ -710,6 +713,294 @@
}
}
- //
+ #region [鍚屾鍗曟嵁]
+ [Route("Sc_ICMOReportBill/Sc_ICMOReportBillViewApi")]
+ [HttpGet]
+ public json Sc_ICMOReportBillViewApi(string BillNo, string BillType)
+ {
+ string sql = string.Empty;
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ //绯荤粺鍙傛暟鏄惁涓虹鏈変簯妯″紡,N涓哄叕鏈変簯妯″紡锛孻涓虹鏈変簯妯″紡
+ if (oSystemParameter.omodel.WMS_CloudMode == "Y")
+ {
+ #region [绉佹湁浜戞ā寮忥紝鐩存帴璋冪敤鏁版嵁搴撳瓨鍌ㄨ繃绋嬫洿鏂癩
+ try
+ {
+ oCN.BeginTran();
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ DataSet DS = oCn.RunProcReturn("exec h_p_WMS_ERPSourceBillToLocal '" + BillNo + "','" + BillType + "'", "h_p_WMS_ERPSourceBillToLocal");
+ if (DS == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍚屾澶辫触";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBack"]) == "2")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "ERP涓笉瀛樺湪璇ュ崟鎹彿";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍚屾鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+ }
+ else
+ {
+ #region [鍏湁浜戞ā寮忥紝璋冪敤WEBAPI鐨勬柟寮忚繘琛屾洿鏂癩
+ var json = new
+ {
+ CreateOrgId = 0,
+ Number = BillNo,
+ Id = ""
+ };
+ #region [閲戣澏閮ㄥ垎]
+ //鐧诲綍閲戣澏
+ var loginRet = InvokeHelper.Login();
+ var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+ //鍒ゆ柇鏄惁鐧诲綍鎴愬姛
+ if (isSuccess < 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = loginRet;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鏌ョ湅 鑾峰彇鏁版嵁
+ var _result = InvokeHelper.View("PRD_MORPT", JsonConvert.SerializeObject(json));
+ var _saveObj = JObject.Parse(_result);
+ //鍒ゆ柇鏁版嵁鏄惁鑾峰彇鎴愬姛
+ if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "閲戣澏鐢熶骇姹囨姤鍗曞悓姝ュけ璐sonRoot锛�" + _result;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+ //鑾峰彇涓昏〃鏁版嵁
+ DataSet Ds;
+ Int64 InterID = 0;
+ Ds = oCN.RunProcReturn("select * from Sc_ICMOReportBillMain where HBillNo = '" + BillNo + "'", "Sc_ICMOReportBillMain");
+ if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
+ {
+ InterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
+ }
+
+ #region [涓昏〃鏁版嵁璧嬪�糫
+ var jsonData = new
+ {
+ HInterID = _saveObj["Result"]["Result"]["Id"],
+ HYear = DateTime.Now.Year,
+ HPeriod = DateTime.Now.Month,
+ HBillType = 3711,
+ HBillSubType = 3711,
+ HDate = _saveObj["Result"]["Result"]["Date"],
+ HBillNo = _saveObj["Result"]["Result"]["BillNo"],
+ HEmpID = 0,
+ HEmpNumber = "",
+ HGroupID = 0,
+ HDeptID = 0,
+ HDeptNumber = "",
+ HRemark = "CLD瀵煎叆",
+ HChecker = _saveObj["Result"]["Result"]["ApproverId"]["Name"],
+ HCheckDate = _saveObj["Result"]["Result"]["ApproveDate"],
+ HMaker = _saveObj["Result"]["Result"]["CreatorId"]["Name"],
+ HMakeDate = _saveObj["Result"]["Result"]["CreateDate"],
+ HUpDater = _saveObj["Result"]["Result"]["ModifierId"]["Name"],
+ HUpDateDate = _saveObj["Result"]["Result"]["ModifyDate"],
+ HDeleteMan = _saveObj["Result"]["Result"]["CANCELER_Id"],
+ HDeleteDate = _saveObj["Result"]["Result"]["CancelDate"],
+ HMainSourceBillType = "",
+ HMainSourceInterID = 0,
+ HMainSourceEntryID = 0,
+ HMainSourceBillNo = "",
+ HPrintQty = 0,
+ HCheckType = "",
+ HERPInterID = _saveObj["Result"]["Result"]["Id"],
+ HERPBillType = _saveObj["Result"]["Result"]["BillType_Id"],
+ HPRDORGID = _saveObj["Result"]["Result"]["PrdOrgId_Id"],
+ };
+ #endregion
+ // 鍒犻櫎涓昏〃瀵瑰簲鏁版嵁
+ sql = $"delete from Sc_ICMOReportBillMain where HInterID = " + InterID;
+ oCN.RunProc(sql);
+
+ //鎻掑叆涓昏〃
+ sql = $@"
+ insert into Sc_ICMOReportBillMain
+ (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HEmpID,HEmpNumber
+ ,HGroupID,HDeptID,HDeptNumber,HRemark,HChecker,HCheckDate,HMaker,HMakeDate
+ ,HUpDater,HUpDateDate,HDeleteMan,HDeleteDate
+ ,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HCheckType
+ ,HERPInterID,HERPBillType,HPRDORGID
+ )
+ values
+ ({jsonData.HInterID},{jsonData.HYear},{jsonData.HPeriod},{jsonData.HBillType},{jsonData.HBillSubType},
+ '{jsonData.HDate}','{jsonData.HBillNo}',{jsonData.HEmpID},'{jsonData.HEmpNumber}',{jsonData.HGroupID},{jsonData.HDeptID},'{jsonData.HDeptNumber}','{jsonData.HRemark}','{jsonData.HChecker}','{jsonData.HCheckDate}','{jsonData.HMaker}','{jsonData.HMakeDate}','{jsonData.HUpDater}','{jsonData.HUpDateDate}','{jsonData.HDeleteMan}','{jsonData.HDeleteDate}','{jsonData.HMainSourceBillType}',{jsonData.HMainSourceInterID},{jsonData.HMainSourceEntryID},'{jsonData.HMainSourceBillNo}',{jsonData.HPrintQty},'{jsonData.HCheckType}',{jsonData.HERPInterID},'{jsonData.HERPBillType}',{jsonData.HPRDORGID})";
+
+ oCN.RunProc(sql);
+
+ #region [鐢宠瀛愯〃鍙橀噺]
+ var dataArr = _saveObj["Result"]["Result"]["PRD_MORPTENTRY"];
+
+ DataSet Cs;
+ double RelationQty = 0;
+ #endregion
+ int i = 0;
+
+ // 鑾峰彇瀛愯〃鏁版嵁
+ Cs = oCN.RunProcReturn("select * from Sc_ICMOReportBillSub where HInterID = " + InterID, "Sc_ICMOReportBillSub");
+ // 鍒犻櫎瀛愯〃瀵瑰簲鏁版嵁
+ sql = $"delete from Sc_ICMOReportBillSub where HInterID = " + InterID;
+ oCN.RunProc(sql);
+
+ foreach (var oSub in dataArr)
+ {
+ #region [瀛愯〃鏁版嵁璧嬪�糫
+
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
+ {
+ RelationQty = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HRelationQty"].ToString());
+
+ i++;
+ }
+
+ var subData = new
+ {
+ HInterID = _saveObj["Result"]["Result"]["Id"],
+ HEntryID = oSub["Id"],
+ HMaterID = oSub["MaterialId_Id"],
+ HMaterNumber = "",
+ HUnitID = oSub["UnitID_Id"],
+ HUnitNumber = "",
+ HQtyMust = oSub["FinishQty"],
+ HQty = oSub["FinishQty"],
+ HWorkerID = 0,
+ HWorkerNumber = "",
+ HSourceID = 0,
+ HSourceNumber = "",
+ HTimes = oSub["StdManHour"],
+ HBadQty = oSub["FailQty"],
+ HBadCount = 0,
+ HQPQty = oSub["QuaQty"],
+ HWasterQty = 0,
+ HRemark = "CLOUD瀵煎叆",
+ HSourceInterID = oSub["SrcInterId"],
+ HSourceEntryID = oSub["SrcEntryId"],
+ HSourceBillNo = oSub["SrcBillNo"],
+ HSourceBillType = oSub["SrcBillType"],
+ HICMOInterID = oSub["MoId"],
+ HICMOEntryID = oSub["MoEntryId"],
+ HICMOBillNo = oSub["MoBillNo"],
+ HSeOrderInterID = 0,
+ HSeOrderEntryID = 0,
+ HSeOrderBillNo = "",
+ HRelationQty = oSub["BaseStockInQuaSelQty"],
+ HRelationMoney = 0,
+ HSplitNO = "",
+ HBarCode = "",
+ HWhID = oSub["StockId_Id"],
+ HSPID = oSub["StockLocId_Id"],
+ HBatChNo = oSub["Lot_Text"],
+ HAuxPropID = oSub["AuxPropId_Id"],
+ HMTONo = oSub["MtoNo"],
+ HPlanMode = 0,
+ HERPInterID = _saveObj["Result"]["Result"]["Id"],
+ HERPEntryID = oSub["Id"],
+ HOWNERTYPEID = oSub["OwnerTypeId"],
+ HISENTRUST = oSub["IsEntrust"] = false ? 0 : 1,
+ HSTOCKINORGID = oSub["StockInOrgId_Id"],
+ HOWNERID = oSub["OwnerId_Id"],
+ HCHECKPRODUCT = oSub["CheckProduct"] = false ? 0 : 1,
+ HQAIP = oSub["QAIP"],
+ HCOSTRATE = oSub["CostRate"],
+ HISBACKFLUSH = oSub["ISBACKFLUSH"],
+ HREQSRC = oSub["ReqSrc"],
+ HREQBILLNO = oSub["ReqBillNo"],
+ HREQBILLID = oSub["ReqBillId"],
+ HREQENTRYSEQ = oSub["ReqEntrySeq"],
+ HREQENTRYID = oSub["ReqEntryId"],
+ HMOMAINENTRYID = oSub["MoMainEntryId"],
+ HSTOCKINQUASELQTY = oSub["BaseStockInQuaSelQty"],
+ HPRODUCTTYPE = oSub["ProductType"],
+ HPROJECTNO = oSub["ProjectNo"],
+ HICMOENTRYSEQ = oSub["MoEntrySeq"],
+ HSEQ = oSub["Seq"],
+ HPRODUCEDATE = oSub["ProduceDate"],
+ HEXPIRYDATE = oSub["ExpiryDate"],
+ HBASEUNITID = oSub["BaseUnitId_Id"],
+ HDEPTID = oSub["WorkshopId_Id"],
+ HGroupID = oSub["ShiftGroupId_Id"],
+ HDESCRIPTION = ""
+ };
+ #endregion
+
+ //鎻掑叆瀛愯〃
+ sql = $@"
+ insert into Sc_ICMOReportBillSub
+ (HInterID,HEntryID,HMaterID,HMaterNumber,HUnitID,HUnitNumber
+ ,HQtyMust,HQty,HWorkerID,HWorkerNumber,HSourceID,HSourceNumber,HTimes,HBadQty,HBadCount,HQPQty
+ ,HWasterQty,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HICMOInterID,HICMOEntryID,HICMOBillNo
+ ,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HRelationMoney,HSplitNO,HBarCode
+ ,HWhID,HSPID,HBatChNo,HAuxPropID,HMTONo,HPlanMode,HERPInterID,HERPEntryID
+ ,HOWNERTYPEID,HISENTRUST,HSTOCKINORGID,HOWNERID,HCHECKPRODUCT,HQAIP,HCOSTRATE,HISBACKFLUSH,HREQSRC
+ ,HREQBILLNO,HREQBILLID,HREQENTRYSEQ,HREQENTRYID,HMOMAINENTRYID,HSTOCKINQUASELQTY,HPRODUCTTYPE,HPROJECTNO
+ ,HICMOENTRYSEQ,HSEQ,HPRODUCEDATE,HEXPIRYDATE,HBASEUNITID,HDEPTID,HGroupID,HDESCRIPTION
+ )
+ values
+ ({subData.HInterID},{subData.HEntryID},{subData.HMaterID},'{subData.HMaterNumber}',{subData.HUnitID},'{subData.HUnitNumber}',{subData.HQtyMust},{subData.HQty},{subData.HWorkerID},'{subData.HWorkerNumber}',{subData.HSourceID},'{subData.HSourceNumber}',{subData.HTimes},{subData.HBadQty},{subData.HBadCount},{subData.HQPQty},{subData.HWasterQty},'{subData.HRemark}',{subData.HSourceInterID},{subData.HSourceEntryID},'{subData.HSourceBillNo}','{subData.HSourceBillType}',{subData.HICMOInterID},{subData.HICMOEntryID},'{subData.HICMOBillNo}',{subData.HSeOrderInterID},{subData.HSeOrderEntryID},'{subData.HSeOrderBillNo}',{subData.HRelationQty},{subData.HRelationMoney},'{subData.HSplitNO}','{subData.HBarCode}',{subData.HWhID},{subData.HSPID},'{subData.HBatChNo}',{subData.HAuxPropID},'{subData.HMTONo}','{subData.HPlanMode}',{subData.HERPInterID},{subData.HERPEntryID},'{subData.HOWNERTYPEID}','{subData.HISENTRUST}',{subData.HSTOCKINORGID},{subData.HOWNERID},'{subData.HCHECKPRODUCT}','{subData.HQAIP}',{subData.HCOSTRATE},'{subData.HISBACKFLUSH}','{subData.HREQSRC}','{subData.HREQBILLNO}',{subData.HREQBILLID},{subData.HREQENTRYSEQ},{subData.HREQENTRYID},{subData.HMOMAINENTRYID},{subData.HSTOCKINQUASELQTY},'{subData.HPRODUCTTYPE}','{subData.HPROJECTNO}',{subData.HICMOENTRYSEQ},{subData.HSEQ},'{subData.HPRODUCEDATE}','{subData.HEXPIRYDATE}',{subData.HBASEUNITID},{subData.HDEPTID},{subData.HGroupID},'{subData.HDESCRIPTION}'
+ )";
+
+ oCN.RunProc(sql);
+ }
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁鍚屾鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ #endregion
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁璇诲彇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1