From 771c05f5c956fe8f057ca31f6d2ed6661fa17602 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期二, 07 二月 2023 15:56:42 +0800
Subject: [PATCH] 新增WIP系统参数,工序末道入库仓库取值类型
---
WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs | 330 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 329 insertions(+), 1 deletions(-)
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index d45f65f..1bcea7f 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
@@ -1,4 +1,5 @@
锘縰sing Model;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
@@ -14,6 +15,8 @@
//鍙戣揣閫氱煡鍗旵ontroller
public class Xs_SeOutStockBillController : ApiController
{
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
private json objJsonResult = new json();
@@ -380,6 +383,331 @@
#endregion
- //
+ #region [鍚屾鍗曟嵁]
+ [Route("Xs_SeOutStockBill/Xs_SeOutStockBillViewApi")]
+ [HttpGet]
+ public json Xs_SeOutStockBillViewApi(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("SAL_DELIVERYNOTICE", 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 Xs_SeOutStockBillMain where HBillNo = '" + BillNo + "'", "Xs_SeOutStockBillMain");
+ 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 = 1402,
+ HBillSubType = 1402,
+ HDate = _saveObj["Result"]["Result"]["Date"],
+ HBillNo = _saveObj["Result"]["Result"]["BillNo"],
+ HBillStatus = _saveObj["Result"]["Result"]["ApproverID_Id"].ToString() == Convert.ToString(0) ? 1 : 2,
+ HCusID = _saveObj["Result"]["Result"]["CustomerID_Id"],
+ HManagerID = _saveObj["Result"]["Result"]["StockerID_Id"],
+ HDeptID = _saveObj["Result"]["Result"]["DeliveryDeptID_Id"],
+ HRemark = _saveObj["Result"]["Result"]["Note"],
+ HAddress = _saveObj["Result"]["Result"]["ReceiveAddress"],
+ HSSID = 0,
+ HCurID = 0,
+ HWHID = 0,
+ HExRate = 1,
+ HEmpID = _saveObj["Result"]["Result"]["SalesManID_Id"],
+ HExplanation = "",
+ HInnerBillNo = "",
+ HSALEORGID = _saveObj["Result"]["Result"]["SaleOrgId_Id"],
+ HDELIVERYORGID = _saveObj["Result"]["Result"]["DeliveryOrgID_Id"],
+ HOWNERID = _saveObj["Result"]["Result"]["OwnerIdHead_Id"],
+ HOWNERTYPEID = _saveObj["Result"]["Result"]["OwnerTypeIdHead"],
+ HERPInterID = _saveObj["Result"]["Result"]["Id"],
+ HERPBillType = _saveObj["Result"]["Result"]["BillTypeID_Id"],
+ HMaker = _saveObj["Result"]["Result"]["CreatorId"]["Name"],
+ HMakeDate = _saveObj["Result"]["Result"]["CreateDate"],
+ HChecker = _saveObj["Result"]["Result"]["ApproverID"]["Name"],
+ HCheckDate = _saveObj["Result"]["Result"]["ApproveDate"],
+ HCloseMan = _saveObj["Result"]["Result"]["CLOSERID_Id"],
+ HCloseDate = _saveObj["Result"]["Result"]["CLOSEDATE"],
+ HSTOCKERGROUPID = _saveObj["Result"]["Result"]["StockerGroupID_Id"],
+ HSALEGROUPID = _saveObj["Result"]["Result"]["SaleGroupID_Id"],
+ HSALEDEPTID = _saveObj["Result"]["Result"]["SaleDeptID_Id"],
+ HBUSINESSTYPE = _saveObj["Result"]["Result"]["BussinessType"],
+ HCARRIERID = _saveObj["Result"]["Result"]["CarrierID_Id"],
+ HRECEIVERID = _saveObj["Result"]["Result"]["ReceiverID_Id"],
+ HSETTLEID = _saveObj["Result"]["Result"]["SettleID_Id"],
+ HPAYERID = _saveObj["Result"]["Result"]["PayerID_Id"],
+ HHEADLOCID = _saveObj["Result"]["Result"]["HeadLocId_Id"],
+ HRECCONTACTID = 0,
+ HRECEIPTCONDITIONID = _saveObj["Result"]["Result"]["FRECEIPTCONDITIONID_Id"],
+ HCORRESPONDORGID = _saveObj["Result"]["Result"]["CorrespondOrgId_Id"],
+ HCARRIAGENO = _saveObj["Result"]["Result"]["CarriageNO"]
+ };
+ #endregion
+ // 鍒犻櫎涓昏〃瀵瑰簲鏁版嵁
+ sql = $"delete from Xs_SeOutStockBillMain where HInterID = " + InterID;
+ oCN.RunProc(sql);
+
+ //鎻掑叆涓昏〃
+ sql = $@"
+ insert into Xs_SeOutStockBillMain
+ (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
+ ,HBillNo,HBillStatus
+ ,HCusID,HManagerID,HDeptID,HRemark,HAddress,HSSID
+ ,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo
+ ,HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID,HERPInterID,HERPBillType
+ ,HMaker,HMakeDate,HChecker,HCheckDate,HCloseMan,HCloseDate
+ ,HSTOCKERGROUPID,HSALEGROUPID,HSALEDEPTID,HBUSINESSTYPE,HCARRIERID,HRECEIVERID
+ ,HSETTLEID,HPAYERID,HHEADLOCID,HRECCONTACTID,HRECEIPTCONDITIONID,HCORRESPONDORGID
+ ,HCARRIAGENO
+ )
+ values
+ ({jsonData.HInterID},{jsonData.HYear},{jsonData.HPeriod},{jsonData.HBillType},{jsonData.HBillSubType},
+ '{jsonData.HDate}','{jsonData.HBillNo}',{jsonData.HBillStatus},{jsonData.HCusID},{jsonData.HManagerID},{jsonData.HDeptID},
+ '{jsonData.HRemark}','{jsonData.HAddress}',{jsonData.HSSID},{jsonData.HCurID},{jsonData.HWHID},{jsonData.HExRate},
+ {jsonData.HEmpID},'{jsonData.HExplanation}','{jsonData.HInnerBillNo}',{jsonData.HSALEORGID},{jsonData.HDELIVERYORGID},
+ {jsonData.HOWNERID},'{jsonData.HOWNERTYPEID}',{jsonData.HERPInterID},'{jsonData.HERPBillType}','{jsonData.HMaker}',
+ '{jsonData.HMakeDate}','{jsonData.HChecker}','{jsonData.HCheckDate}','{jsonData.HCloseMan}','{jsonData.HCloseDate}',
+ {jsonData.HSTOCKERGROUPID},{jsonData.HSALEGROUPID},{jsonData.HSALEDEPTID},'{jsonData.HBUSINESSTYPE}',{jsonData.HCARRIERID},
+ {jsonData.HRECEIVERID},{jsonData.HSETTLEID},{jsonData.HPAYERID},{jsonData.HHEADLOCID},{jsonData.HRECCONTACTID},
+ {jsonData.HRECEIPTCONDITIONID},{jsonData.HCORRESPONDORGID},'{jsonData.HCARRIAGENO}')";
+
+ oCN.RunProc(sql);
+
+ #region [鐢宠瀛愯〃鍙橀噺]
+ var dataArr = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEENTRY"];
+
+ DataSet Cs;
+ double RelationQty = 0;
+ #endregion
+ int i = 0;
+
+ // 鑾峰彇瀛愯〃鏁版嵁
+ Cs = oCN.RunProcReturn("select * from Xs_SeOutStockBillSub where HInterID = " + InterID, "Xs_SeOutStockBillSub");
+ // 鍒犻櫎瀛愯〃瀵瑰簲鏁版嵁
+ sql = $"delete from Xs_SeOutStockBillSub 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"],
+ HUnitID = oSub["UnitID_Id"],
+ HQty = oSub["Qty"],
+ HPrice = oSub["Price"],
+ HMoney = 0,
+ HWHID = oSub["StockID_Id"],
+ HSPID = oSub["StockLocID_Id"],
+ HRemark = oSub["NoteEntry"],
+ HSourceInterID = 0,
+ HSourceEntryID = 0,
+ HSourceBillNo = oSub["SrcBillNo"],
+ HSourceBillType = oSub["SrcType"],
+ HSeOrderInterID = 0,
+ HSeOrderEntryID = oSub["SOEntryId"],
+ HSeORderBillNo = oSub["OrderNo"],
+ HOWNERID = oSub["OwnerID_Id"],
+ HOWNERTYPEID = oSub["OwnerTypeID"],
+ HSETTLEORGID = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["SettleOrgID_Id"],
+ HMoveStockQty = oSub["StockBaseTransQty"],
+ HRelationQty = oSub["StockBaseJoinOutQty"],
+ HAuxPropID = oSub["AuxpropID_Id"],
+ HBatchNO = oSub["Lot_Text"],
+ HMTONo = oSub["MTONO"],
+ HERPInterID = _saveObj["Result"]["Result"]["Id"],
+ HERPEntryID = oSub["Id"],
+ HCUSTMATID = oSub["CustMatID_Id"],
+ HBASEUNITID = oSub["BaseUnitID_Id"],
+ HBFLOWID = oSub["FBFLowId_Id"],
+ HOUTCONTROL = oSub["OutContROL"],
+ HSTOCKUNITID = oSub["StockUnitID_Id"],
+ HROWTYPE = oSub["RowType"],
+ HROWID = oSub["RowId"],
+ HPARENTROWID = oSub["ParentRowId"],
+ HPARENTMATID = oSub["ParentMatId_Id"],
+ HTAXCOMBINATION = oSub["TaxCombination_Id"],
+ HPRICECOEFFICIENT = oSub["PriceCoefficient"],
+ HSYSPRICE = oSub["SysPrice"],
+ HLIMITDOWNPRICE = oSub["LimitDownPrice"],
+ HPRICEUNITID = oSub["PriceUnitId_Id"],
+ HTAXPRICE = oSub["TaxPrice"],
+ HTAXRATE = oSub["TaxRate"],
+ HTAXNETPRICE = oSub["TaxNetPrice"],
+ HDISCOUNTRATE = oSub["DiscountRate"],
+ HISFREE = oSub["IsFree"],
+ HLOCALCURRID = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["LocalCurrID_Id"],
+ HSETTLECURRID = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["SettleCurrID_Id"],
+ HEXCHANGETYPEID = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["ExchangeTypeID_Id"],
+ HSETTLETYPEID = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["SettleTypeID_Id"],
+ HRECEIPTCONDITIONID = 0,
+ HEXCHANGERATE = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["ExchangeRate"],
+ HISINCLUDEDTAX = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["IsIncludedTax"],
+ HISPRICEEXCLUDETAX = _saveObj["Result"]["Result"]["SAL_DELIVERYNOTICEFIN"][0]["IsPriceExcludeTax"],
+ HTAXRATEID = 0,
+ HTaxRate_TAX = oSub["TaxRate"],
+ HCOSTPERCENT = 0,
+ HVAT = 0,
+ HSELLERWITHHOLDING = 0,
+ HBUYERWITHHOLDING = 0
+ };
+ #endregion
+
+ //鎻掑叆瀛愯〃
+ sql = $@"
+ insert into Xs_SeOutStockBillSub
+ (HInterID,HEntryID,HMaterID,HUnitID,HQty
+ ,HPrice,HMoney,HWHID,HSPID,HRemark
+ ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSeOrderInterID,HSeOrderEntryID,HSeORderBillNo
+ ,HOWNERID,HOWNERTYPEID,HSETTLEORGID,HMoveStockQty
+ ,HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID
+ ,HCUSTMATID,HBASEUNITID,HBFLOWID,HOUTCONTROL
+ ,HSTOCKUNITID,HROWTYPE,HROWID,HPARENTROWID,HPARENTMATID
+ ,HTAXCOMBINATION,HPRICECOEFFICIENT,HSYSPRICE,HLIMITDOWNPRICE
+ ,HPRICEUNITID,HTAXPRICE,HTAXRATE,HTAXNETPRICE,HDISCOUNTRATE,HISFREE
+ ,HLOCALCURRID,HSETTLECURRID,HEXCHANGETYPEID,HSETTLETYPEID,HRECEIPTCONDITIONID
+ ,HEXCHANGERATE,HISINCLUDEDTAX,HISPRICEEXCLUDETAX
+ ,HTAXRATEID,HTaxRate_TAX,HCOSTPERCENT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING
+ )
+ values
+ ({subData.HInterID},{subData.HEntryID},{subData.HMaterID},{subData.HUnitID},{subData.HQty},{subData.HPrice},
+ {subData.HMoney},{subData.HWHID},{subData.HSPID},'{subData.HRemark}',{subData.HSourceInterID},{subData.HSourceEntryID},
+ '{subData.HSourceBillNo}','{subData.HSourceBillType}',{subData.HSeOrderInterID},{subData.HSeOrderEntryID},
+ '{subData.HSeORderBillNo}',{subData.HOWNERID},'{subData.HOWNERTYPEID}',{subData.HSETTLEORGID},{subData.HMoveStockQty},
+ {subData.HRelationQty},{subData.HAuxPropID},'{subData.HBatchNO}','{subData.HMTONo}',{subData.HERPInterID},{subData.HERPEntryID},
+ '{subData.HCUSTMATID}',{subData.HBASEUNITID},'{subData.HBFLOWID}','{subData.HOUTCONTROL}',{subData.HSTOCKUNITID},'{subData.HROWTYPE}',
+ '{subData.HROWID}','{subData.HPARENTROWID}','{subData.HPARENTMATID}',{subData.HTAXCOMBINATION},{subData.HPRICECOEFFICIENT},
+ '{subData.HSYSPRICE}',{subData.HLIMITDOWNPRICE},{subData.HPRICEUNITID},{subData.HTAXPRICE},'{subData.HTAXRATE}',
+ '{subData.HTAXNETPRICE}',{subData.HDISCOUNTRATE},'{subData.HISFREE}','{subData.HLOCALCURRID}','{subData.HSETTLECURRID}',
+ '{subData.HEXCHANGETYPEID}','{subData.HSETTLETYPEID}','{subData.HRECEIPTCONDITIONID}',{subData.HEXCHANGERATE},'{subData.HISINCLUDEDTAX}',
+ '{subData.HISPRICEEXCLUDETAX}',{subData.HTAXRATEID},{subData.HTaxRate_TAX},'{subData.HCOSTPERCENT}','{subData.HVAT}',
+ {subData.HSELLERWITHHOLDING},{subData.HBUYERWITHHOLDING})";
+
+ 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