| | |
| | | //收料通知单Controller |
| | | public class Cg_POInStockBillController : ApiController |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill(); |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据基础资料ID 查找记录 |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #region 根据物料内码获取物料信息 |
| | | [Route("Cg_POInStockBill/getMaterialByMaterID")] |
| | | [HttpGet] |
| | | public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID) |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" + |
| | | " from Gy_Material AS a " + |
| | | " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " + |
| | | " where a.HItemID =" + HMaterID; |
| | | |
| | | var dataSet = oCN.RunProcReturn(sql, "Gy_Material"); |
| | | |
| | | |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataTable> { code = -1, msg = "不存在该物料" }; |
| | | |
| | | return new ApiResult<DataTable> { code = 1, msg = "查询成功", data = dataSet.Tables[0] }; |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 反审核 |
| | |
| | | var model = sMainSub["model"].ToString(); |
| | | var entry = sMainSub["model"]["HENTRY"].ToString(); |
| | | |
| | | LogService.Write("收料通知单同步 sMainSub:" + sMainSub); |
| | | model = "[" + model.ToString() + "]"; |
| | | List<ClsCg_POInStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(model); |
| | | List<ClsCg_POInStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillSub>>(entry); |
| | |
| | | sql = @" |
| | | Insert Into Cg_POInStockBillMain |
| | | (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate |
| | | ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HRemark |
| | | ,HBillNo,HBillStatus,HSupID,HSupDealerID,HManagerID,HEmpID,HDeptID,HRemark |
| | | ,HMaker,HMakeDate,HChecker,HCheckDate,HOWNERTYPEID,HOWNERID |
| | | ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID |
| | | ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID |
| | | ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID) |
| | | ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo) |
| | | values(" + mainList[0].HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" + |
| | | mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "'," + mainList[0].HBillStatus + "," + mainList[0].HSupID + |
| | | mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "'," + mainList[0].HBillStatus + "," + mainList[0].HSupID + "," + (mainList[0].HSupDealerID == 0 ? mainList[0].HSupID : mainList[0].HSupDealerID) + |
| | | "," + mainList[0].HManagerID + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + |
| | | "','" + mainList[0].HMakeDate + "','" + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HOWNERTYPEID + "'," + mainList[0].HOWNERID + "," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "'," + mainList[0].HPURCHASEORGID + "," + mainList[0].HSTOCKORGID + "," + mainList[0].HREQUIREORGID + "," + |
| | | mainList[0].HSTOCKGROUPID + ",'" + mainList[0].HSENDBILLNO + "','" + mainList[0].HLADBILLNO + "'," + mainList[0].HPURDEPTID + "," + mainList[0].HPURGROUPID + "," + mainList[0].HSUPPLYID + "," + |
| | | mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + ")"; |
| | | mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + ",'" + mainList[0].HInnerBillNo + "'" + ")"; |
| | | oCN.RunProc(sql); |
| | | //保存主表 |
| | | foreach (var oSub in subList) |
| | |
| | | ,HPRICECOEFFICIENT,HPRICEUNITID,HPRICELISTENTRY,HSAMPLEDAMAGEQTY,HSAMPLEDAMAGEBASEQTY |
| | | ,HPAYORGID,HSETTLEORGID,HSETTLECURRID,HSETTLEMODEID,HEXCHANGETYPEID,HPAYCONDITONID |
| | | ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX |
| | | ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID) |
| | | ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID,HSalOutStockBillNo,HSalOutStockEntryId) |
| | | values( |
| | | '{oSub.HInterID}','{oSub.HEntryID}','{oSub.HMaterID}','{oSub.HUnitID}','{oSub.HQty}','{oSub.HPrice}' |
| | | ,'{oSub.HMoney}','{oSub.HWHID}','{oSub.HSPID}','{oSub.HRemark}','{oSub.HTaxMoney}','{oSub.HTaxRate}','{oSub.HTaxMoney_TAX}','{oSub.HTaxRate_TAX}' |
| | | ,'{oSub.HSourceInterID}','{oSub.HSourceEntryID}','{oSub.HSourceBillNo}','{oSub.HSourceBillType}','{oSub.HPOOrderInterID}','{oSub.HPOOrderEntryID}','{oSub.HPOOrderBillNo}','{oSub.HAuxPropID}','{oSub.HBatchNO}','{oSub.HMTONo}','{oSub.HPlanMode}','{oSub.HERPInterID}','{oSub.HERPEntryID}','{oSub.HRelationQty}','{oSub.HGiveAwayFlag}','{oSub.HReceiveQty}','{oSub.HSEQ}','{oSub.HPRODUCEDATE}','{oSub.HEXPIRYDATE}', |
| | | '{oSub.HSUPPLYLOT}','{oSub.HREQTRACENO}','{oSub.HBOMID}','{oSub.HSTOCKUNITID}','{oSub.HBASEUNITID}','{oSub.HSTOCKSTATUSID}','{oSub.HKEEPERTYPEID}','{oSub.HPROJECTNO}','{oSub.HCHECKINCOMING}','{oSub.HTaxPrice}','{oSub.HDISCOUNTRATE}','{oSub.HPRICECOEFFICIENT}','{oSub.HPRICEUNITID}','{oSub.HPRICELISTENTRY}','{oSub.HSAMPLEDAMAGEQTY}','{oSub.HSAMPLEDAMAGEBASEQTY}','{oSub.HPAYORGID}','{oSub.HSETTLEORGID}','{oSub.HSETTLECURRID}','{oSub.HSETTLEMODEID}','{oSub.HEXCHANGETYPEID}','{oSub.HPAYCONDITONID}','{oSub.HEXCHANGERATE}','{oSub.HLOCALCURRID}','{oSub.HISINCLUDEDTAX}','{oSub.HISPRICEEXCLUDETAX}','{oSub.HTAXRATEID}','{oSub.HCOSTPERCENT}','{oSub.HCOSTAMOUNT}','{oSub.HVAT}','{oSub.HSELLERWITHHOLDING}','{oSub.HBUYERWITHHOLDING}','{oSub.HSecUnitID}')"; |
| | | '{oSub.HSUPPLYLOT}','{oSub.HREQTRACENO}','{oSub.HBOMID}','{oSub.HSTOCKUNITID}','{oSub.HBASEUNITID}','{oSub.HSTOCKSTATUSID}','{oSub.HKEEPERTYPEID}','{oSub.HPROJECTNO}','{oSub.HCHECKINCOMING}','{oSub.HTaxPrice}','{oSub.HDISCOUNTRATE}','{oSub.HPRICECOEFFICIENT}','{oSub.HPRICEUNITID}','{oSub.HPRICELISTENTRY}','{oSub.HSAMPLEDAMAGEQTY}','{oSub.HSAMPLEDAMAGEBASEQTY}','{oSub.HPAYORGID}','{oSub.HSETTLEORGID}','{oSub.HSETTLECURRID}','{oSub.HSETTLEMODEID}','{oSub.HEXCHANGETYPEID}','{oSub.HPAYCONDITONID}','{oSub.HEXCHANGERATE}','{oSub.HLOCALCURRID}','{oSub.HISINCLUDEDTAX}','{oSub.HISPRICEEXCLUDETAX}','{oSub.HTAXRATEID}','{oSub.HCOSTPERCENT}','{oSub.HCOSTAMOUNT}','{oSub.HVAT}','{oSub.HSELLERWITHHOLDING}','{oSub.HBUYERWITHHOLDING}','{oSub.HSecUnitID}','{oSub.HSalOutStockBillNo}','{oSub.HSalOutStockEntryId}')"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | oCN.Commit(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("收料通知单同步异常:" + e.ToString()); |
| | | |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 收料通知单 审核/反审核 |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">审核(0),反审核(1)</param> |
| | | /// <param name="CurUserName">审核人</param> |
| | | /// <returns></returns> |
| | | [Route("Cg_POInStockBill/AuditCg_POInStockBill")] |
| | | [HttpGet] |
| | | public object AuditCg_POInStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Cg_POInStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //审核单据 |
| | | if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能进行反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反审核单据 |
| | | if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 收料通知单 关闭/反关闭功能 |
| | | [Route("Cg_POInStockBill/CloseCg_POInStockBill")] |
| | | [HttpGet] |
| | | public object CloseCg_POInStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Cg_POInStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要再反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 收料通知单 作废/反作废功能 |
| | | [Route("Cg_POInStockBill/DropCg_POInStockBill")] |
| | | [HttpGet] |
| | | public object DropCg_POInStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有作废权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Cg_POInStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不需要再作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //作废单据 |
| | | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未作废!不需要再反作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反作废单据 |
| | | if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region [同步单据] |
| | | [Route("Cg_POInStockBill/Cg_POInStockBillViewApi")] |
| | | [HttpGet] |
| | | public json Cg_POInStockBillViewApi(string BillNo, string BillType) |
| | | { |
| | | string sql = string.Empty; |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | //系统参数是否为私有云模式,N为公有云模式,Y为私有云模式 |
| | | 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("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JObject.Parse(_result); |
| | | //判断数据是否获取成功 |
| | | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "金蝶收料通知单同步失败jsonRoot:" + _result; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | //获取主表数据 |
| | | DataSet Ds; |
| | | Int64 InterID = 0; |
| | | Int64 ManagerID = 0; |
| | | Int64 EmpID = 0; |
| | | Int64 DeptID = 0; |
| | | Ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain where HBillNo = '" + BillNo + "'", "Cg_POInStockBillMain"); |
| | | 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()); |
| | | ManagerID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"].ToString()); |
| | | EmpID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"].ToString()); |
| | | DeptID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"].ToString()); |
| | | } |
| | | |
| | | #region [主表数据赋值] |
| | | var jsonData = new |
| | | { |
| | | HInterID = _saveObj["Result"]["Result"]["Id"], |
| | | HYear = DateTime.Now.Year, |
| | | HPeriod = DateTime.Now.Month, |
| | | HBillType = 1103, |
| | | HBillSubType = _saveObj["Result"]["Result"]["BusinessType"].ToString() == "CG" ? 12510 : 12511, |
| | | HDate = _saveObj["Result"]["Result"]["Date"], |
| | | HBillNo = _saveObj["Result"]["Result"]["BillNo"], |
| | | HBillStatus = 2, |
| | | HSupID = _saveObj["Result"]["Result"]["SupplierId_Id"], |
| | | HManagerID = ManagerID, |
| | | HEmpID = EmpID, |
| | | HDeptID = DeptID, |
| | | HRemark = "CLOUD导入", |
| | | HMaker = _saveObj["Result"]["Result"]["CreatorId_Id"], |
| | | HMakeDate = _saveObj["Result"]["Result"]["CreateDate"], |
| | | HChecker = _saveObj["Result"]["Result"]["ApproverId_Id"], |
| | | HCheckDate = _saveObj["Result"]["Result"]["ApproveDate"], |
| | | HOWNERTYPEID = _saveObj["Result"]["Result"]["OwnerTypeIdHead"], |
| | | HOWNERID = _saveObj["Result"]["Result"]["OwnerIdHead_Id"], |
| | | HERPInterID = _saveObj["Result"]["Result"]["Id"], |
| | | HERPBillType = _saveObj["Result"]["Result"]["BillTypeId_Id"], |
| | | HPURCHASEORGID = _saveObj["Result"]["Result"]["PurOrgId_Id"], |
| | | HSTOCKORGID = _saveObj["Result"]["Result"]["StockOrgId_Id"], |
| | | HREQUIREORGID = _saveObj["Result"]["Result"]["DemandOrgId_Id"], |
| | | HSTOCKGROUPID = _saveObj["Result"]["Result"]["StockGroupId_Id"], |
| | | HSENDBILLNO = _saveObj["Result"]["Result"]["SendBillNo"], |
| | | HLADBILLNO = _saveObj["Result"]["Result"]["LadBillNo"], |
| | | HPURDEPTID = _saveObj["Result"]["Result"]["PurDeptId_Id"], |
| | | HPURGROUPID = _saveObj["Result"]["Result"]["PurGroupId_Id"], |
| | | HSUPPLYID = _saveObj["Result"]["Result"]["SupplyId_Id"], |
| | | HSETTLEID = _saveObj["Result"]["Result"]["SettleId_Id"], |
| | | HCHARGEID = _saveObj["Result"]["Result"]["ChargeId_Id"], |
| | | HBUSINESSTYPE = _saveObj["Result"]["Result"]["BusinessType"], |
| | | HSUPPLYADDRESS = _saveObj["Result"]["Result"]["SupplyAddress"], |
| | | HCORRESPONDORGID = _saveObj["Result"]["Result"]["CorrespondOrgId_Id"], |
| | | HPROVIDERCONTACTID = _saveObj["Result"]["Result"]["ProviderContactId_Id"], |
| | | }; |
| | | #endregion |
| | | // 删除主表对应数据 |
| | | sql = $"delete from Cg_POInStockBillMain where HInterID = " + InterID; |
| | | oCN.RunProc(sql); |
| | | |
| | | //插入主表 |
| | | sql = $@" |
| | | insert into Cg_PoInstockbillMain |
| | | (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate |
| | | ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HRemark |
| | | ,HMaker,HMakeDate,HChecker,HCheckDate,HOWNERTYPEID,HOWNERID |
| | | ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID |
| | | ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID |
| | | ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID |
| | | ) |
| | | values |
| | | ({jsonData.HInterID},{jsonData.HYear},{jsonData.HPeriod},{jsonData.HBillType},{jsonData.HBillSubType},'{jsonData.HDate}','{jsonData.HBillNo}', |
| | | {jsonData.HBillStatus},{jsonData.HSupID},{jsonData.HManagerID},{jsonData.HEmpID},{jsonData.HDeptID},'{jsonData.HRemark}','{jsonData.HMaker}', |
| | | '{jsonData.HMakeDate}','{jsonData.HChecker}','{jsonData.HCheckDate}','{jsonData.HOWNERTYPEID}','{jsonData.HOWNERID}',{jsonData.HERPInterID}, |
| | | '{jsonData.HERPBillType}',{jsonData.HPURCHASEORGID},{jsonData.HSTOCKORGID},{jsonData.HREQUIREORGID},{jsonData.HSTOCKGROUPID},'{jsonData.HSENDBILLNO}', |
| | | '{jsonData.HLADBILLNO}',{jsonData.HPURDEPTID},{jsonData.HPURGROUPID},{jsonData.HSUPPLYID},{jsonData.HSETTLEID},{jsonData.HCHARGEID},'{jsonData.HBUSINESSTYPE}', |
| | | '{jsonData.HSUPPLYADDRESS}',{jsonData.HCORRESPONDORGID},{jsonData.HPROVIDERCONTACTID})"; |
| | | oCN.RunProc(sql); |
| | | |
| | | #region [申请子表变量] |
| | | var dataArr = _saveObj["Result"]["Result"]["PUR_ReceiveEntry"]; |
| | | |
| | | DataSet Cs; |
| | | double Qty = 0; |
| | | double Money = 0; |
| | | Int64 WHID = 0; |
| | | Int64 SPID = 0; |
| | | string subRemark = ""; |
| | | double TaxMoney = 0; |
| | | double TaxMoney_TAX = 0; |
| | | double TaxRate_TAX = 0; |
| | | Int64 SourceBillType = 0; |
| | | Int64 POOrderInterID = 0; |
| | | string POORderBillNo = ""; |
| | | string BatchNO = ""; |
| | | Int64 ERPInterID = 0; |
| | | Int64 ERPEntryID = 0; |
| | | double RelationQty = 0; |
| | | Int64 SecUnitID = 0; |
| | | Int64 PAYORGID = 0; |
| | | Int64 PAYCONDITONID = 0; |
| | | Int64 SETTLEORGID = 0; |
| | | Int64 SETTLECURRID = 0; |
| | | Int64 SETTLEMODEID = 0; |
| | | Int64 EXCHANGETYPEID = 0; |
| | | double EXCHANGERATE = 0; |
| | | Int64 LOCALCURRID = 0; |
| | | Int64 ISINCLUDEDTAX = 0; |
| | | Int64 ISPRICEEXCLUDETAX = 0; |
| | | Int64 PlanMode = 0; |
| | | #endregion |
| | | int i = 0; |
| | | |
| | | // 获取子表数据 |
| | | Cs = oCN.RunProcReturn("select * from Cg_POInStockBillSub where HInterID = " + InterID, "Cg_POInStockBillSub"); |
| | | // 删除子表对应数据 |
| | | sql = $"delete from Cg_POInStockBillSub 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) |
| | | { |
| | | Qty = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HQty"].ToString()); |
| | | Money = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HMoney"].ToString()); |
| | | WHID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HWHID"].ToString()); |
| | | SPID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSPID"].ToString()); |
| | | subRemark = ClsPub.isStrNull(Cs.Tables[0].Rows[i]["HRemark"]); |
| | | TaxMoney = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HTaxMoney"].ToString()); |
| | | TaxMoney_TAX = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HTaxMoney_TAX"].ToString()); |
| | | TaxRate_TAX = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HTaxRate_TAX"].ToString()); |
| | | SourceBillType = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSourceBillType"].ToString()); |
| | | POOrderInterID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HPOOrderInterID"].ToString()); |
| | | POORderBillNo = ClsPub.isStrNull(Cs.Tables[0].Rows[i]["HPOORderBillNo"]); |
| | | BatchNO = ClsPub.isStrNull(Cs.Tables[0].Rows[i]["HBatchNO"]); |
| | | ERPInterID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HERPInterID"].ToString()); |
| | | ERPEntryID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HERPEntryID"].ToString()); |
| | | RelationQty = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HRelationQty"].ToString()); |
| | | SecUnitID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSecUnitID"].ToString()); |
| | | PAYORGID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HPAYORGID"].ToString()); |
| | | PAYCONDITONID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HPAYCONDITONID"].ToString()); |
| | | SETTLEORGID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSETTLEORGID"].ToString()); |
| | | SETTLECURRID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSETTLECURRID"].ToString()); |
| | | SETTLEMODEID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HSETTLEMODEID"].ToString()); |
| | | EXCHANGETYPEID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HEXCHANGETYPEID"].ToString()); |
| | | EXCHANGERATE = ClsPub.isDoule(Cs.Tables[0].Rows[i]["HEXCHANGERATE"].ToString()); |
| | | LOCALCURRID = ClsPub.isLong(Cs.Tables[0].Rows[i]["HLOCALCURRID"].ToString()); |
| | | ISINCLUDEDTAX = ClsPub.isLong(Cs.Tables[0].Rows[i]["HISINCLUDEDTAX"].ToString()); |
| | | ISPRICEEXCLUDETAX = ClsPub.isLong(Cs.Tables[0].Rows[i]["HISPRICEEXCLUDETAX"].ToString()); |
| | | PlanMode = ClsPub.isLong(Cs.Tables[0].Rows[i]["HPlanMode"].ToString()); |
| | | |
| | | i++; |
| | | } |
| | | |
| | | var subData = new |
| | | { |
| | | HInterID = _saveObj["Result"]["Result"]["Id"], |
| | | HEntryID = oSub["Id"], |
| | | HMaterID = oSub["MaterialID_Id"], |
| | | HUnitID = oSub["UnitId_Id"], |
| | | HQty = Qty, |
| | | HPrice = oSub["Price"], |
| | | HMoney = Money, |
| | | HWHID = WHID, |
| | | HSPID = SPID, |
| | | HRemark = subRemark, |
| | | HTaxMoney = TaxMoney, |
| | | HTaxRate = oSub["TaxRate"], |
| | | HTaxMoney_TAX = TaxMoney_TAX, |
| | | HTaxRate_TAX = TaxRate_TAX, |
| | | HSourceInterID = oSub["SrcId"], |
| | | HSourceEntryID = oSub["SrcEntryId"], |
| | | HSourceBillNo = oSub["SrcBillNo"], |
| | | HSourceBillType = SourceBillType, |
| | | HPOOrderInterID = POOrderInterID, |
| | | HPOOrderEntryID = oSub["POORDERENTRYID"], |
| | | HPOORderBillNo = POORderBillNo, |
| | | HAuxPropID = oSub["AuxPropId_Id"], |
| | | HBatchNO = BatchNO, |
| | | HMTONo = oSub["MtoNo"], |
| | | HPlanMode = PlanMode, |
| | | HERPInterID = ERPInterID, |
| | | HERPEntryID = ERPEntryID, |
| | | HRelationQty = RelationQty, |
| | | HGiveAwayFlag = oSub["GiveAway"] = false ? 0 : 1, |
| | | HReceiveQty = oSub["ReceiveQty"], |
| | | HSecUnitID = SecUnitID, |
| | | HSEQ = oSub["Seq"], |
| | | HPRODUCEDATE = oSub["ProduceDate"], |
| | | HEXPIRYDATE = oSub["ExpiryDate"], |
| | | HSUPPLYLOT = oSub["SupplierLot"], |
| | | HREQTRACENO = oSub["ReqTraceNo"], |
| | | HBOMID = oSub["BomId_Id"], |
| | | HSTOCKUNITID = oSub["StockUnitID_Id"], |
| | | HBASEUNITID = oSub["BaseUnitId_Id"], |
| | | HSTOCKSTATUSID = oSub["StockStatusId_Id"], |
| | | HKEEPERTYPEID = oSub["KeeperTypeId"], |
| | | HPROJECTNO = oSub["ProjectNo"], |
| | | HCHECKINCOMING = oSub["CheckInComing"] = false ? 0 : 1, |
| | | HTAXPRICE = oSub["TaxPrice"], |
| | | HDISCOUNTRATE = oSub["DiscountRate"], |
| | | HPRICECOEFFICIENT = oSub["PriceCoefficient"], |
| | | HPRICEUNITID = oSub["PriceUnitId_Id"], |
| | | HPRICELISTENTRY = oSub["PriceListEntry_Id"], |
| | | HTAXCOMBINATION = oSub["TaxCombination_Id"], |
| | | HSAMPLEDAMAGEQTY = oSub["SampleDamageQty"], |
| | | HSAMPLEDAMAGEBASEQTY = oSub["SampleDamageBaseQty"], |
| | | HOWNERTYPEID = oSub["OwnerTypeId"], |
| | | HOWNERID = oSub["OwnerId_Id"], |
| | | HBFLOWID = oSub["FBFLowId_Id"], |
| | | HPAYORGID = PAYORGID, |
| | | HSETTLEORGID = SETTLEORGID, |
| | | HSETTLECURRID = SETTLECURRID, |
| | | HSETTLEMODEID = SETTLEMODEID, |
| | | HEXCHANGETYPEID = EXCHANGETYPEID, |
| | | HPAYCONDITONID = PAYCONDITONID, |
| | | HEXCHANGERATE = EXCHANGERATE, |
| | | HLOCALCURRID = LOCALCURRID, |
| | | HISINCLUDEDTAX = ISINCLUDEDTAX, |
| | | HISPRICEEXCLUDETAX = ISPRICEEXCLUDETAX, |
| | | HTAXRATEID = 0, |
| | | HCOSTPERCENT = 0, |
| | | HCOSTAMOUNT = 0, |
| | | HVAT = 0, |
| | | HSELLERWITHHOLDING = 0, |
| | | HBUYERWITHHOLDING = 0, |
| | | }; |
| | | #endregion |
| | | |
| | | |
| | | //插入子表 |
| | | sql = $@" |
| | | insert into Cg_PoInstockbillSub |
| | | (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice |
| | | ,HMoney,HWHID,HSPID,HRemark,HTaxMoney,HTaxRate,HTaxMoney_TAX,HTaxRate_TAX |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID,HPOOrderEntryID,HPOORderBillNo |
| | | ,HAuxPropID,HBatchNO,HMTONo,HPlanMode,HERPInterID,HERPEntryID |
| | | ,HRelationQty,HGiveAwayFlag,HReceiveQty,HSecUnitID |
| | | ,HSEQ,HPRODUCEDATE,HEXPIRYDATE,HSUPPLYLOT,HREQTRACENO,HBOMID,HSTOCKUNITID |
| | | ,HBASEUNITID,HSTOCKSTATUSID,HKEEPERTYPEID,HPROJECTNO,HCHECKINCOMING |
| | | ,HTAXPRICE,HDISCOUNTRATE,HPRICECOEFFICIENT,HPRICEUNITID,HPRICELISTENTRY |
| | | ,HTAXCOMBINATION,HSAMPLEDAMAGEQTY,HSAMPLEDAMAGEBASEQTY,HOWNERTYPEID,HOWNERID,HBFLOWID |
| | | ,HPAYORGID,HSETTLEORGID,HSETTLECURRID,HSETTLEMODEID,HEXCHANGETYPEID,HPAYCONDITONID |
| | | ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX |
| | | ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,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.HTaxMoney},{subData.HTaxRate},{subData.HTaxMoney_TAX}, |
| | | {subData.HTaxRate_TAX},{subData.HSourceInterID},{subData.HSourceEntryID},'{subData.HSourceBillNo}',{subData.HSourceBillType}, |
| | | {subData.HPOOrderInterID},{subData.HPOOrderEntryID},'{subData.HPOORderBillNo}',{subData.HAuxPropID},'{subData.HBatchNO}', |
| | | '{subData.HMTONo}',{subData.HPlanMode},{subData.HERPInterID},{subData.HERPEntryID},{subData.HRelationQty},{subData.HGiveAwayFlag}, |
| | | {subData.HReceiveQty},{subData.HSecUnitID},{subData.HSEQ},'{subData.HPRODUCEDATE}','{subData.HEXPIRYDATE}','{subData.HSUPPLYLOT}', |
| | | '{subData.HREQTRACENO}',{subData.HBOMID},{subData.HSTOCKUNITID},{subData.HBASEUNITID},{subData.HSTOCKSTATUSID},'{subData.HKEEPERTYPEID}', |
| | | '{subData.HPROJECTNO}',{subData.HCHECKINCOMING},{subData.HTAXPRICE},{subData.HDISCOUNTRATE}, |
| | | {subData.HPRICECOEFFICIENT},{subData.HPRICEUNITID},{subData.HPRICELISTENTRY},'{subData.HTAXCOMBINATION}',{subData.HSAMPLEDAMAGEQTY}, |
| | | {subData.HSAMPLEDAMAGEBASEQTY},'{subData.HOWNERTYPEID}',{subData.HOWNERID},'{subData.HBFLOWID}',{subData.HPAYORGID},{subData.HSETTLEORGID}, |
| | | {subData.HSETTLECURRID},{subData.HSETTLEMODEID},{subData.HEXCHANGETYPEID},{subData.HPAYCONDITONID},{subData.HEXCHANGERATE}, |
| | | {subData.HLOCALCURRID},{subData.HISINCLUDEDTAX},{subData.HISPRICEEXCLUDETAX},{subData.HTAXRATEID},{subData.HCOSTPERCENT}, |
| | | {subData.HCOSTAMOUNT},{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 |
| | | } |
| | | } |