| | |
| | | return dal.DisSourceBillList(sWhere); |
| | | } |
| | | |
| | | //返回生产备料单列表 |
| | | /// <summary> |
| | | /// 返回生产备料单列表 |
| | | /// </summary> |
| | | /// <param name="sWhere">过滤条件</param> |
| | | /// <returns></returns> |
| | | [WebMethod] |
| | | public DataSet GetSc_PrepareMTRLBillList(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | DataSet ds; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_PrepareMTRLBillList_Lite " + sWhere + " order by 单据号 desc,HMaterID", "h_v_IF_PrepareMTRLBillList_Lite"); |
| | | if (ds == null && ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return ds; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CLOUD 采购退料单--来源单据 |
| | |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "3721") //生产备料单 |
| | | { |
| | | if (SaveMoveStockBill_PrepareMTRL_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | //直接调拨 |
| | | else if (sHSourceType == "-1") |
| | | { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "3721") //生产备料单 |
| | | { |
| | | if (SaveMoveStockBill_PrepareMTRL_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "-1")//无源单 |
| | | { |
| | | if (SaveMoveOut_CLD(oMain, oSystemParameterMain, ref sErrMsg)) |
| | |
| | | else |
| | | { |
| | | LogService.Write("生成直接调拨单(源单:生产发料通知单)成功!" + sRemark); |
| | | sErrMsg = "生成直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 直接调拨单 源单:生产备料单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | private bool SaveMoveStockBill_PrepareMTRL_CLD(Model.ClsKf_MoveStockBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | string sRemark = ""; |
| | | //从配置文件获取 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(); |
| | | |
| | | sRemark = sRemark + " ;获取验证CLOUD账号密码" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | 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(); |
| | | //写入WMS调拨单 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_MoveStockBillSub_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" + |
| | | ",HStockStyle,HTransferDirect,HShipType" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1207','1207'," + 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.HStockStyle + "','" + oMain.HTransferDirect + "','" + oMain.HShipType + "'" + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_PrepareMTRLToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | |
| | | sRemark = sRemark + " ;生成出入库单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //判断是否启用器具管理,系统参数 启用器具管理 |
| | | if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") |
| | | { |
| | | string HMouldBillType = "3814"; |
| | | 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"); |
| | | } |
| | | |
| | | sRemark = sRemark + " ;判断是否启用器具管理" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //根据TMP表 返回 信息 |
| | | DataSet Ds; |
| | | if (oSystemParameterMain.WMS_CloudMode == "N") //系统参数 是否为私有云模式(N为公有云模式,Y为私有云模式) |
| | | { |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockBill_PrepareMTRL_PUBCLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMoveStockBill_PrepareMTRL_PUBCLD_New"); |
| | | sRemark = sRemark + " ;公有云模式"; |
| | | } |
| | | else |
| | | { |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockBill_PrepareMTRL_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMoveStockBill_PrepareMTRL_CLD_New"); |
| | | sRemark = sRemark + " ;私有云模式"; |
| | | } |
| | | 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\":{ " + |
| | | //\"FID\":\"0\", |
| | | "\"FBillNo\":\"" + oMain.HBillNo + "\"," + |
| | | "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," + |
| | | "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," + |
| | | "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," + |
| | | "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," + |
| | | "\"FSettleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleOrgId"]) + "\"}," + |
| | | "\"FSaleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSaleOrgId"]) + "\"}," + |
| | | "\"FStockOutOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOutOrgId"]) + "\"}," + |
| | | "\"FOwnerTypeOutIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeOutIdHead"]) + "\"," + |
| | | "\"FOwnerOutIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerOutIdHead"]) + "\"}," + |
| | | "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," + |
| | | "\"FIsIncludedTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsIncludedTax"]) + "," + |
| | | "\"FIsPriceExcludeTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsPriceExcludeTax"]) + "," + |
| | | "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," + |
| | | "\"FSETTLECURRID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSETTLECURRID"]) + "\"}," + |
| | | "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," + |
| | | //\"FStockerId\":{\"FNumber\":\"\"}, |
| | | //\"FStockerGroupId\":{\"FNumber\":\"\"}, |
| | | "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\"," + |
| | | //\"FNote\":\"\", |
| | | "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," + |
| | | "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," + |
| | | //\"FCustID\":{\"FNUMBER\":\"\"}, |
| | | //\"FScanBox\":\"\", |
| | | //\"FThirdSystem\":\"\", |
| | | //\"FThirdSrcBillNo\":\"\", |
| | | //\"FThirdSrcId\":\"\", |
| | | sJson_MainCustom + |
| | | "\"FBillEntry\": [ "; |
| | | 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_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"]) + "\"},"; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | sJson_DestBatchNo = ""; |
| | | } |
| | | |
| | | //是否启用保质期控制 |
| | | 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"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | } |
| | | |
| | | //辅助属性 |
| | | 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"]) + "\"}},"; |
| | | } |
| | | |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | //\"FEntryID\":\"0\", |
| | | " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," + |
| | | //" \"FAuxPropId\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxPropId"]) + "\"}}," + |
| | | sJson_FAUXPROPID + |
| | | " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," + |
| | | " \"FQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "," + |
| | | sJson_BatchNo + |
| | | " \"FSrcStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\"}," + |
| | | sJson_SrcStockPlace + |
| | | //\"FPrice\":\"0\", |
| | | " \"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\":\"\", |
| | | //\"FAmount\":\"0\", |
| | | sJson_FProduceDate + |
| | | " \"FDestStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\"}," + |
| | | " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | " \"FBusinessDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBusinessDate"]) + "\"," + |
| | | sJson_FExpiryDate + |
| | | " \"FOwnerTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeOutId"]) + "\"," + |
| | | " \"FOwnerOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerOutId"]) + "\"}," + |
| | | " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," + |
| | | //\"FNoteEntry\":\"\", |
| | | " \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," + |
| | | //\"FOutJoinQty\":\"0\", |
| | | " \"FSecUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitId"]) + "\"}," + |
| | | //\"FSecQty\":\"0\", |
| | | //\"FBASEOUTJOINQTY\":\"0\", |
| | | " \"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\", |
| | | " \"FBaseQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseQty"]) + "," + |
| | | " \"FISFREE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISFREE"]) + "," + |
| | | " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | //\"FActQty\":\"0\", |
| | | " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," + |
| | | " \"FKeeperTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeOutId"]) + "\"," + |
| | | " \"FKeeperOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperOutId"]) + "\"}," + |
| | | //\"FDiscountRate\":\"0\", |
| | | //\"FRepairQty\":\"0\", |
| | | //\"FRETURNNOTE\":\"\", |
| | | sJson_DestBatchNo + |
| | | " \"FDestMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\"}," + |
| | | " \"FDestBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestBomId"]) + "\"}," + |
| | | //\"FServiceContext\":\"\", |
| | | //\"FPriceUnitID\":{\"FNumber\":\"\"}, |
| | | //\"FPriceQty\":\"0\", |
| | | //\"FPriceBaseQty\":\"0\", |
| | | //\"FSOEntryId\":\"0\", |
| | | " \"FTransReserveLink\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "," + |
| | | //\"FQmEntryId\":\"0\", |
| | | //\"FConvertEntryId\":\"0\", |
| | | //\"FThirdSrcEntryId\":\"\", |
| | | " \"FOrderNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderNo"]) + "\"," + |
| | | " \"FSNUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," + |
| | | " \"FORDERTYPE\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FORDERTYPE"]) + "\"}," + |
| | | " \"FSrcBillTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillTypeId"]) + "\"," + |
| | | " \"FSrcBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," + |
| | | sJson_SubCustom + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | " \"FBillEntry_Link\": [{" + |
| | | " \"FBillEntry_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | " \"FBillEntry_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | " \"FBillEntry_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | " \"FBillEntry_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | " \"FBillEntry_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | " \"FBillEntry_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," + |
| | | " \"FBillEntry_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; |
| | | |
| | | sRemark = sRemark + " ;获取CLOUD单据API递入值" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_TransferDirect", sJson }); |
| | | |
| | | sRemark = sRemark + " ;生成CLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMove '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | sRemark = sRemark + " ;生成单据后回填字段信息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成直接调拨单失败!" + HReturn; |
| | | LogService.Write("生成直接调拨单(源单:生产备料单)失败!" + HReturn + sJson); //写入txt文本 |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | sRemark = sRemark + sJson; |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成直接调拨单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("生成回滚" + sRemark); |
| | | sErrMsg = "生成直接调拨单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_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_TransferDirect", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TransferDirect", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | LogService.Write("审核单据失败" + sRemark); |
| | | sErrMsg = "生成直接调拨单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成并审核直接调拨单(源单:生产备料单)成功!" + sRemark); |
| | | sErrMsg = "生成并审核直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("审核回滚" + sRemark); |
| | | sErrMsg = "审核直接调拨单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成直接调拨单(源单:生产备料单)成功!" + sRemark); |
| | | sErrMsg = "生成直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "3721") //生产备料单 |
| | | { |
| | | if (SaveMateOutBill_PrepareMTRL_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | |
| | | else |
| | | { |
| | | LogService.Write("生成生产领料单(源单:生产发料通知单)成功!" + sRemark); |
| | | sErrMsg = "生成生产领料单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生产领料单 (源单:生产备料单) |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveMateOutBill_PrepareMTRL_CLD(Model.ClsKf_MateOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | string sRemark = ""; |
| | | //从配置文件获取 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(); |
| | | |
| | | sRemark = sRemark + " ;获取验证CLOUD账号密码" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | |
| | | if (oSystemParameterMain.WMS_BillDateMode == "N") //系统参数 单据日期是否取界面递入日期 |
| | | { |
| | | oMain.HDate = DateTime.Today; |
| | | } |
| | | |
| | | 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_MateOutBillSub_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" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1204','1204'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HDate.ToShortDateString() + "','" + 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.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Sc_UpDateRelation_PrepareMTRLToMateOut_Add " + oMain.HInterID.ToString()); |
| | | |
| | | sRemark = sRemark + " ;生成出入库单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //根据TMP表 返回 信息 |
| | | DataSet Ds; |
| | | if (oSystemParameterMain.WMS_CloudMode == "N") //系统参数 是否为私有云模式(N为公有云模式,Y为私有云模式) |
| | | { |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMateOutBill_PrepareMTRL_PUBCLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMateOutBill_PrepareMTRL_PUBCLD_New"); |
| | | sRemark = sRemark + " ;公有云模式"; |
| | | } |
| | | else |
| | | { |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMateOutBill_PrepareMTRL_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMateOutBill_PrepareMTRL_CLD_New"); |
| | | sRemark = sRemark + " ;私有云模式"; |
| | | } |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | string sJson_Date = ""; //单据日期 |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | if (oSystemParameterMain.WMS_BillDateMode == "Y") //系统参数 单据日期是否取界面递入日期 |
| | | { |
| | | sJson_Date = "\"FDATE\":\"" + oMain.HDate.ToShortDateString() + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_Date = "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\","; |
| | | } |
| | | |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | | //\"FID\":\"0\", |
| | | "\"FBillType\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) + "\"}," + |
| | | //"\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | sJson_Date + |
| | | "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," + |
| | | //\"FStockId0\":{\"FNumber\":\"\"}, |
| | | "\"FPrdOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPrdOrgId"]) + "\"}," + |
| | | //\"FWorkShopId\":{\"FNumber\":\"\"}, |
| | | "\"FOwnerTypeId0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeId0"]) + "\"," + |
| | | //\"FOwnerId0\":{\"FNumber\":\"\"}, |
| | | "\"FPickerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPickerId"]) + "\"}," + |
| | | "\"FSTOCKERID\":{\"FNAME\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKERID"]) + "\"}," + |
| | | //\"FDescription\":\"\", |
| | | "\"FCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FCurrId"]) + "\"}," + |
| | | "\"FIsCrossTrade\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsCrossTrade"]) + "\"," + |
| | | "\"FVmiBusiness\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FVmiBusiness"]) + "\"," + |
| | | //\"FScanBox\":\"\", |
| | | //\"FSourceType\":\"\", |
| | | sJson_MainCustom + |
| | | "\"FEntity\": [ "; |
| | | 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_StockPlace = ""; |
| | | string sJson_FProduceDate = ""; //生产日期 |
| | | string sJson_FExpiryDate = ""; //有效期至 |
| | | 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"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | } |
| | | |
| | | //是否启用保质期控制 |
| | | 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"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | } |
| | | |
| | | //辅助属性 |
| | | 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]["FStockLocId"]) == "") |
| | | { |
| | | sJson_StockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},"; |
| | | } |
| | | |
| | | sJson_Entry = sJson_Entry + "{" + |
| | | //\"FEntryID\":\"0\", |
| | | "\"FParentMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentMaterialId"]) + "\"}," + |
| | | "\"FBaseStockActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseStockActualQty"]) + "\"," + |
| | | //\"FConsome\":\"\", |
| | | "\"FFPMBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FFPMBillNo"]) + "\"," + |
| | | "\"FOptQueue\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOptQueue"]) + "\"," + |
| | | "\"FReserveType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReserveType"]) + "\"," + |
| | | "\"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," + |
| | | "\"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," + |
| | | "\"FAppQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAppQty"]) + "\"," + |
| | | "\"FActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FActualQty"]) + "\"," + |
| | | "\"FEntryVmiBusiness\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntryVmiBusiness"]) + "\"," + |
| | | //\"FOptPlanBillNo\":\"\", |
| | | "\"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," + |
| | | //\"FOptPlanBillId\":\"0\", |
| | | sJson_StockPlace + |
| | | //\"FWorkCenterId\":{\"FNUMBER\":\"\"}, |
| | | //\"FOptDetailId\":\"0\", |
| | | sJson_BatchNo + |
| | | //\"FCobyBomEntryID\":\"0\", |
| | | "\"FProcessId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProcessId"]) + "\"}," + |
| | | "\"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," + |
| | | "\"FGroupRow\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FGroupRow"]) + "\"," + |
| | | "\"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," + |
| | | //\"FProduceDate\":\"1900-01-01\", |
| | | //\"FEntrtyMemo\":\"\", |
| | | "\"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | //\"FProjectNo\":\"\", |
| | | "\"FMoBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoBillNo"]) + "\"," + |
| | | "\"FMoEntryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoEntryId"]) + "\"," + |
| | | "\"FPPBomEntryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPPBomEntryId"]) + "\"," + |
| | | "\"FOperId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOperId"]) + "\"," + |
| | | "\"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | "\"FStockUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockUnitId"]) + "\"}," + |
| | | "\"FStockAppQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockAppQty"]) + "\"," + |
| | | "\"FStockActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockActualQty"]) + "\"," + |
| | | //\"FStockAllowOverQty\":\"0\", |
| | | "\"FSecUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitId"]) + "\"}," + |
| | | //\"FSecActualQty\":\"0\", |
| | | //\"FSecAllowOverQty\":\"0\", |
| | | "\"FMoId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoId"]) + "\"," + |
| | | "\"FMoEntrySeq\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoEntrySeq"]) + "\"," + |
| | | //\"FAllowOverQty\":\"0\", |
| | | "\"FPPBomBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPPBomBillNo"]) + "\"," + |
| | | "\"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," + |
| | | "\"FBaseAppQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseAppQty"]) + "\"," + |
| | | "\"FBaseActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseActualQty"]) + "\"," + |
| | | //\"FBaseAllowOverQty\":\"0\", |
| | | "\"FEntryWorkShopId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntryWorkShopId"]) + "\"}," + |
| | | //"\"FAuxPropId\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxPropId"]) + "\"}}," + |
| | | sJson_FAUXPROPID + |
| | | "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | "\"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," + |
| | | "\"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," + |
| | | //\"FExpiryDate\":\"1900-01-01\", |
| | | "\"FSrcBillType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillType"]) + "\"," + |
| | | "\"FSrcBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," + |
| | | //\"FPrice\":\"0\", |
| | | "\"FEntrySrcInterId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcInterId"]) + "\"," + |
| | | //\"FAmount\":\"0\", |
| | | "\"FEntrySrcEnteryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcEnteryId"]) + "\"," + |
| | | "\"FEntrySrcEntrySeq\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcEntrySeq"]) + "\"," + |
| | | "\"FParentOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentOwnerTypeId"]) + "\"," + |
| | | "\"FParentOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentOwnerId"]) + "\"}," + |
| | | //\"FSRCBIZBILLTYPE\":{\"FNAME\":\"\"}, |
| | | //\"FSRCBIZBILLNO\":\"\", |
| | | //\"FSRCBIZINTERID\":\"0\", |
| | | //\"FSRCBIZENTRYID\":\"0\", |
| | | //\"FSRCBIZENTRYSEQ\":\"0\", |
| | | "\"FPickingStatus\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPickingStatus"]) + "\"," + |
| | | // |
| | | "\"FSNUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," + |
| | | sJson_FProduceDate + |
| | | sJson_FExpiryDate + |
| | | sJson_SubCustom + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialId\":{\"FNumber\":\"\"}, |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | "\"FEntity_Link\": [ { " + |
| | | "\"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | "\"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | "\"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | "\"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | "\"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | "\"FEntity_Link_FBASEACTUALQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEACTUALQTYOLD"]) + "\"," + |
| | | "\"FEntity_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; |
| | | |
| | | sRemark = sRemark + " ;获取CLOUD单据API递入值" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "PRD_PickMtrl", sJson }); |
| | | |
| | | sRemark = sRemark + " ;生成CLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMateOut '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | sRemark = sRemark + " ;生成单据后回填字段信息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成生产领料单失败!" + HReturn; |
| | | LogService.Write("生成生产领料单(源单:生产备料单)失败!" + HReturn + sJson); //写入txt文本 |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | sRemark = sRemark + sJson; |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成生产领料单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("生成回滚" + sRemark); |
| | | sErrMsg = "生成生产领料单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_MateOutBill_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[] { "PRD_PickMtrl", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_PickMtrl", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | LogService.Write("审核单据失败" + sRemark); |
| | | sErrMsg = "生成生产领料单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成并审核生产领料单(源单:生产备料单)成功!" + sRemark); |
| | | sErrMsg = "生成并审核生产领料单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("审核回滚" + sRemark); |
| | | sErrMsg = "审核生产领料单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成生产领料单(源单:生产备料单)成功!" + sRemark); |
| | | sErrMsg = "生成生产领料单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | |
| | | //将整托条码对应的条码编号拼成一串字符串 |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | sBarCode_New = sBarCode_New + "," + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); |
| | | sBarCode_New = sBarCode_New + ",'" + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"])+"'"; |
| | | } |
| | | sBarCode_New = sBarCode_New.Remove(0, 1); //去掉字符串第一个字符 |
| | | |
| | |
| | | "," + model.HRelationInterID.ToString() + "," + model.HRelationEntryID.ToString() + ",'" + model.HRelationBillNo + "'," + Convert.ToString(model.HRedBlueFlag ? 1 : 0) + ",'" + model.HMTONo + "',0" + |
| | | "," + model.HSTOCKORGID.ToString() + "," + model.HOWNERID.ToString() + "," + model.HSTOCKORGID.ToString() + ",'','','" + model.HSubBillType + "'" + |
| | | ",0,0,'" + model.HCusBarCode + "'," + model.HMulSourceBill.ToString() + |
| | | "from Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0" |
| | | //"from Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0" |
| | | "from Gy_BarCodeBill with(nolock) where HBarCode in (" + sBarCode_New + ")" |
| | | ); |
| | | return true; |
| | | } |
| | |
| | | //将整托条码对应的条码编号拼成一串字符串 |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | sBarCode_New = sBarCode_New + "," + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); |
| | | sBarCode_New = sBarCode_New + ",'" + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"])+"'"; |
| | | } |
| | | sBarCode_New = sBarCode_New.Remove(0, 1); //去掉字符串第一个字符 |
| | | |
| | |
| | | "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" + |
| | | "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + "," + oMain.HSTOCKORGID.ToString() + ",'','',0" + |
| | | ",0,0,'" + oMain.HCusBarCode + "',0" + |
| | | "from Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0" |
| | | //"from Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0" |
| | | "from Gy_BarCodeBill with(nolock) where HBarCode in (" + sBarCode_New + ")" |
| | | ); |
| | | return true; |
| | | } |