| | |
| | | return false; |
| | | } |
| | | } |
| | | if (sHSourceType == "1243") //调拨申请单 |
| | | { |
| | | if (SaveMoveStockStepOutBill_MoveStockRequest_CLD_New(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "-1") //无源单 |
| | | { |
| | | if (SaveMoveStockStepOutBill_CLD_New(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分步式调出单 源单:调拨申请单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveMoveStockStepOutBill_MoveStockRequest_CLD_New(Model.ClsKf_MoveStockStepOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码 |
| | | if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo)) |
| | | { |
| | | sErrMsg = Pub_Class.ClsPub.sExeReturnInfo; |
| | | return false; |
| | | } |
| | | |
| | | //获取CLOUD账号密码 |
| | | string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName; |
| | | string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd; |
| | | DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID); |
| | | if (ds11 == null || ds11.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]); |
| | | sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]); |
| | | } |
| | | |
| | | string HReturn; |
| | | ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl); |
| | | string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117 |
| | | bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //生成出入库单据 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_MoveStockStepOutBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_ICStockBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HSTOCKINORGID,HSTOCKOUTORGID,HStockStyle" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1250','1250'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ", " + oMain.HStockInOrgID.ToString() + "," + oMain.HStockOutOrgID.ToString() + ",'" + oMain.HStockStyle + "'" + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //系统参数 启用器具管理 |
| | | { |
| | | string HMouldBillType = "3840"; |
| | | oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3"); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockStepOutBill_MoveStockRequest_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMoveStockStepOutBill_MoveStockRequest_CLD_New"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | | //\"FID\":\"0\", |
| | | "\"FOwnerTypeIdHead \":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," + |
| | | "\"FBillTypeID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\" }," + |
| | | "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," + |
| | | "\"FOwnerIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\" }," + |
| | | "\"FOwnerTypeInIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeInIdHead"]) + "\"," + |
| | | "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," + |
| | | "\"FOwnerInIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerInIdHead"]) + "\" }," + |
| | | "\"FStockOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\" }," + |
| | | "\"FStockInOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockInOrgId"]) + "\" }," + |
| | | "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | "\"FBaseCurrId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\" }," + |
| | | "\"FVESTONWAY\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FVESTONWAY"]) + "\"," + |
| | | //\"FSTOCKERID\":{\"FNumber\":\"\"}, |
| | | //\"FSTOCKERGROUPID\":{\"FNumber\":\"\"}, |
| | | //\"FNOTE\":\"\", |
| | | "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," + |
| | | //\"FScanBox\":\"\", |
| | | //\"FCustID\":{\"FNUMBER\":\"\"}, |
| | | "\"FSUPPLIERID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\" }," + |
| | | sJson_MainCustom + |
| | | "\"FSTKTRSOUTENTRY\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_DestBatchNo = ""; //调入批号 |
| | | string sJson_SrcStockPlace = ""; |
| | | string sJson_DestStockPlace = ""; |
| | | string sJson_FProduceDate = ""; //生产日期 |
| | | string sJson_FExpiryDate = ""; //有效期至 |
| | | string sJson_FDestProduceDate = ""; //调入生产日期 |
| | | string sJson_FDestExpiryDate = ""; //调入有效期至 |
| | | string sJson_FAUXPROPID = ""; |
| | | string sJson_SubCustom = ""; //子表自定义字段 |
| | | |
| | | //子表自定义字段 |
| | | sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]); |
| | | |
| | | //是否启用批次管理 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | | sJson_DestBatchNo = " \"FDESTLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTLOT"]) + "\"}, \"FDESTLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTLOT"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | sJson_DestBatchNo = ""; |
| | | } |
| | | |
| | | //辅助属性 |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | |
| | | //调出仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) == "") |
| | | { |
| | | sJson_SrcStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_SrcStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}},"; |
| | | } |
| | | //调入仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) == "") |
| | | { |
| | | sJson_DestStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_DestStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}},"; |
| | | } |
| | | |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1") //是否启用保质期控制 |
| | | { |
| | | sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\","; |
| | | sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\","; |
| | | sJson_FDestProduceDate = " \"FDestProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestProduceDate"]) + "\","; |
| | | sJson_FDestExpiryDate = " \"FDESTEXPIRYDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTEXPIRYDATE"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | sJson_FDestProduceDate = ""; |
| | | sJson_FDestExpiryDate = ""; |
| | | } |
| | | // |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | //\"FEntryID\":\"0\", |
| | | "\"FMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\" }," + |
| | | "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," + |
| | | sJson_FAUXPROPID + |
| | | "\"FUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\" }," + |
| | | sJson_BatchNo + |
| | | "\"FSrcStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\" }," + |
| | | sJson_SrcStockPlace + |
| | | "\"FDestStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\" }," + |
| | | sJson_DestStockPlace + |
| | | "\"FBOMId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMId"]) + "\"}," + |
| | | "\"FSrcStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\" }," + |
| | | //"\"FDELICHKQUALIFYTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDELICHKQUALIFYTYPE"]) + "\"," + |
| | | "\"FDestStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\" }," + |
| | | sJson_FProduceDate + |
| | | "\"FBusinessDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBusinessDate"]) + "\"," + |
| | | "\"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | "\"FOwnerId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\" }," + |
| | | "\"FOwnerTypeInId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERTYPEINID"]) + "\"," + |
| | | "\"FOwnerInId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerInId"]) + "\" }," + |
| | | //"\"FEntryNote\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntryNote"]) + "\"," + |
| | | "\"FKeeperTypeInId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKEEPERTYPEINID"]) + "\"," + |
| | | "\"FKeeperInId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperInId"]) + "\" }," + |
| | | "\"FDestMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\" }," + |
| | | "\"FBaseUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\" }," + |
| | | "\"FExtAuxUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\" }," + |
| | | //\"FExtAuxUnitQty\":\"0\", |
| | | "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | "\"FKeeperId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\" }," + |
| | | //\"FQmEntryId\":\"0\", |
| | | //\"FConvertEntryId\":\"0\", |
| | | "\"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | "\"FDestMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMTONO"]) + "\"," + |
| | | "\"FDestBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestBomId"]) + "\"}," + |
| | | "\"FSNUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\" }," + |
| | | "\"FSecUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitID"]) + "\" }," + |
| | | "\"FCheckDelivery\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckDelivery"]) + "\"," + |
| | | "\"FSrcBillDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillDate"]) + "\"," + |
| | | "\"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + |
| | | "\"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," + |
| | | sJson_FExpiryDate + |
| | | sJson_FDestProduceDate + |
| | | sJson_FDestExpiryDate + |
| | | sJson_DestBatchNo + |
| | | sJson_SubCustom + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link\": [ { " + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" + |
| | | " } ]," + |
| | | " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_TRANSFEROUT", sJson }); //调用保存方式 |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMoveStockStepOut '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockStepOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_TRANSFEROUT", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TRANSFEROUT", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成分步式调出单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核分步式调出单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核分步式调出单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成分步式调出单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | " \"FDISCOUNTRATE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDISCOUNTRATE"]) + "," + |
| | | //\"FPriceDiscount\":\"0\", |
| | | //\"FActQty\":\"0\", |
| | | " \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + |
| | | " \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + |
| | | //" \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + //移到下方 |
| | | //" \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + //移到下方 |
| | | " \"FSALBASEQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALBASEQTY"]) + "," + |
| | | " \"FPRICEBASEQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPRICEBASEQTY"]) + "," + |
| | | //\"FProjectNo\":\"\", |
| | |
| | | " \"FBASEUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEUNITQTY"]) + "," + |
| | | " \"FSALBASENUM\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALBASENUM"]) + "," + |
| | | " \"FSTOCKBASEDEN\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKBASEDEN"]) + "," + |
| | | " \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + |
| | | " \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + |
| | | sJson_SubCustom + |
| | | |
| | | " \"FTaxDetailSubEntity\": [ { " + |
| | |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成销售出库单成功!" + sJson); |
| | | oCn.Commit(); |
| | | } |
| | | } |