| | |
| | | public string HDeptName { get; set; }//部门 |
| | | public string HJLStatus { get; set; }//拣料状态 |
| | | public string user { get; set; }//制单人 |
| | | public string Arbitrarily { get; set; }//任意参数 |
| | | } |
| | | |
| | | [Route("Sc_ComplementGoods/ComplementGoodsList")] |
| | |
| | | //反序列化传递的值 |
| | | ComplementGoods com = JsonConvert.DeserializeObject<ComplementGoods>(sWhere.ToString()); |
| | | |
| | | oCN.RunProc($"exec h_p_JIT_ComplementGoodsBillList_Query '{com.MaterialNumber}','{com.MaterialName}','{com.MaterialModel}','{com.HGD}'," + |
| | | $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'"); |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_ComplementGoodsBillList_Query '{com.MaterialNumber}','{com.MaterialName}','{com.MaterialModel}','{com.HGD}'," + |
| | | $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'", "h_p_JIT_ComplementGoodsBillList_Query"); |
| | | |
| | | //bool a = AddSendGoodsBillSynChronizAtion("PLD00000114", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (com.HJLStatus == "未拣料") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from ##ComplementGoodsBillList_Query1 where 1=1 " + com.Arbitrarily + "", "##ComplementGoodsBillList_Query1"); |
| | | } |
| | | else if (com.HJLStatus == "已拣料") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from ##ComplementGoodsBillList_Query2 where 1=1 " + com.Arbitrarily + "", "##ComplementGoodsBillList_Query2"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("select * from ##ComplementGoodsBillList_Query3 where 1=1 " + com.Arbitrarily + "", "##ComplementGoodsBillList_Query3"); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "调拨单生成失败"; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | oCN.BeginTran(); |
| | | |
| | | ds = oCN.RunProcReturn($"select a.HMainSourceEntryID,b.HMaterID from JIT_SendGoodsBillMain a with(nolock) inner join JIT_SendGoodsBillSub b with(nolock) on a.HInterID = b.HInterID where a.HMainSourceInterID={SourceInterID} and a.HBillStatus=1", "JIT_SendGoodsBillMain"); |
| | | |
| | | long InterID = 0; |
| | | string HBillNo = ""; |
| | | for (int i = 0; i < listCa.Count; i++) |
| | | { |
| | | // 则代表配送单没有数据 需要添加数据 |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | |
| | | if (i == 0) |
| | | { |
| | | InterID = DBUtility.ClsPub.CreateBillID_Prod("460201", ref DBUtility.ClsPub.sExeReturnInfo); |
| | |
| | | ",HMaterID,HQty,HWHID,HSPID,HISCheck,HCheckSubMan,HCheckSubDate,HStockOutOrgID,HStockInOrgID,HSCWHID)" + |
| | | $"values({InterID},'{HBillNo}',{i + 1}, {listCa[i].HMaterID},{listCa[i].本次拣料数量}," + |
| | | $" {listCa[i].HWHID},{listCa[i].HSPID},0,'{user}', GETDATE(),{listCa[i].HStockOutOrgID},{listCa[i].HStockInOrgID},{listCa[i].HSCWHID})"); |
| | | } |
| | | else |
| | | { |
| | | //修改配送单的配送数量 |
| | | oCN.RunProc($"update b set b.HQty=b.HQty+{listCa[i].本次拣料数量} from JIT_SendGoodsBillMain a with(nolock) inner join JIT_SendGoodsBillSub b with(nolock) on a.HInterID = b.HInterID " + |
| | | $"where HMainSourceInterID ={SourceInterID} and b.HMaterID ={listCa[i].HMaterID} and a.HBillStatus =1 "); |
| | | } |
| | | |
| | | |
| | | DataSet dsTable = new DataSet(); |
| | | //查询JIT_ComplementGoodsBillSub_LK |
| | |
| | | } |
| | | } |
| | | |
| | | //同步金蝶直接调拨单 |
| | | objJsonResult = AddSendGoodsBillSynChronizAtion(HBillNo); |
| | | |
| | | oCN.Commit(); |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | public json AddSendGoodsBillSynChronizAtion(string HBillNo) |
| | | { |
| | | ds = oCN.RunProcReturn("exec JIT_SendGoodsBillSynChronizAtion '" + HBillNo + "'", "JIT_SendGoodsBillSynChronizAtion"); |
| | | |
| | | foreach (DataRow dr in ds.Tables[0].Rows) |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | JObject model = new JObject(); |
| | | model.Add("FBillTypeID", new JObject() { ["Fnumber"] = dr["FBillTypeID"].ToString() }); //单据类型 |
| | | model.Add("FDate", dr["FDate"].ToString()); |
| | | model.Add("FBILLNO", dr["FBILLNO"].ToString()); |
| | | model.Add("FStockOrgId", new JObject() { ["Fnumber"] = dr["FStockOrgId"].ToString() }); |
| | | model.Add("FOwnerTypeIdHead", dr["FOwnerTypeIdHead"].ToString()); |
| | | model.Add("FTransferBizType", dr["FTransferBizType"].ToString()); |
| | | model.Add("FOwnerTypeOutIdHead", dr["FOwnerTypeOutIdHead"].ToString()); |
| | | model.Add("FTransferDirect", dr["FTransferDirect"].ToString()); |
| | | model.Add("FStockOutOrgId", new JObject() { ["Fnumber"] = dr["FStockOutOrgId"].ToString() }); |
| | | |
| | | JArray Fentity = new JArray(); |
| | | foreach (DataRow item in ds.Tables[1].Rows) |
| | | { |
| | | JObject FentityModel = new JObject(); |
| | | FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMaterialId"].ToString() }); |
| | | FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUnitID"].ToString() }); |
| | | FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = item["FBaseUnitId"].ToString() }); |
| | | FentityModel.Add("FOwnerTypeId", item["FOwnerTypeId"].ToString()); |
| | | FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = item["FOwnerId"].ToString() }); |
| | | FentityModel.Add("FOwnerTypeOutId", item["FOwnerTypeOutId"].ToString()); |
| | | FentityModel.Add("FOwnerOutId", new JObject() { ["Fnumber"] = item["FOwnerOutId"].ToString() }); |
| | | FentityModel.Add("FKeeperTypeId", item["FKeeperTypeId"].ToString()); |
| | | FentityModel.Add("FKeeperId", new JObject() { ["Fnumber"] = item["FKeeperId"].ToString() }); |
| | | FentityModel.Add("FKeeperTypeOutId", item["FKeeperTypeOutId"].ToString()); |
| | | FentityModel.Add("FKeeperOutId", new JObject() { ["Fnumber"] = item["FKeeperOutId"].ToString() }); |
| | | FentityModel.Add("FDestStockId", new JObject() { ["Fnumber"] = item["FDestStockId"].ToString() }); |
| | | FentityModel.Add("FSrcStockId", new JObject() { ["Fnumber"] = item["FSrcStockId"].ToString() }); |
| | | FentityModel.Add("FQty", item["FQty"].ToString()); |
| | | Fentity.Add(FentityModel); |
| | | } |
| | | model.Add("FBillEntry", Fentity); |
| | | |
| | | JObject jsonRoot = new JObject() |
| | | foreach (DataRow dr in ds.Tables[0].Rows) |
| | | { |
| | | ["Creator"] = "", |
| | | ["NeedUpDateFields"] = new JArray(), |
| | | ["NeedReturnFields"] = new JArray(), |
| | | ["IsDeleteEntry"] = "false", |
| | | ["SubSystemId"] = "", |
| | | ["IsVerifyBaseDataField"] = "false", |
| | | ["Model"] = model |
| | | }; |
| | | 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.Save("STK_TransferDirect", jsonRoot.ToString()); |
| | | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = result; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | JObject model = new JObject(); |
| | | model.Add("FBillTypeID", new JObject() { ["Fnumber"] = dr["FBillTypeID"].ToString() }); //单据类型 |
| | | model.Add("FDate", dr["FDate"].ToString()); |
| | | model.Add("FBILLNO", dr["FBILLNO"].ToString()); |
| | | model.Add("FStockOrgId", new JObject() { ["Fnumber"] = ds.Tables[1].Rows[0]["FStockOrgId"].ToString() }); |
| | | model.Add("FOwnerTypeIdHead", dr["FOwnerTypeIdHead"].ToString()); |
| | | model.Add("FTransferBizType", ds.Tables[1].Rows[0]["FTransferBizType"].ToString()); |
| | | model.Add("FOwnerTypeOutIdHead", dr["FOwnerTypeOutIdHead"].ToString()); |
| | | model.Add("FTransferDirect", dr["FTransferDirect"].ToString()); |
| | | model.Add("FStockOutOrgId", new JObject() { ["Fnumber"] = ds.Tables[1].Rows[0]["FStockOutOrgId"].ToString() }); |
| | | |
| | | JArray Fentity = new JArray(); |
| | | foreach (DataRow item in ds.Tables[1].Rows) |
| | | { |
| | | JObject FentityModel = new JObject(); |
| | | FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMaterialId"].ToString() }); |
| | | FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUnitID"].ToString() }); |
| | | FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = item["FBaseUnitId"].ToString() }); |
| | | FentityModel.Add("FOwnerTypeId", item["FOwnerTypeId"].ToString()); |
| | | FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = item["FOwnerId"].ToString() }); |
| | | FentityModel.Add("FOwnerTypeOutId", item["FOwnerTypeOutId"].ToString()); |
| | | FentityModel.Add("FOwnerOutId", new JObject() { ["Fnumber"] = item["FOwnerOutId"].ToString() }); |
| | | FentityModel.Add("FKeeperTypeId", item["FKeeperTypeId"].ToString()); |
| | | FentityModel.Add("FKeeperId", new JObject() { ["Fnumber"] = item["FKeeperId"].ToString() }); |
| | | FentityModel.Add("FKeeperTypeOutId", item["FKeeperTypeOutId"].ToString()); |
| | | FentityModel.Add("FKeeperOutId", new JObject() { ["Fnumber"] = item["FKeeperOutId"].ToString() }); |
| | | FentityModel.Add("FDestStockId", new JObject() { ["Fnumber"] = item["FDestStockId"].ToString() }); |
| | | FentityModel.Add("FSrcStockId", new JObject() { ["Fnumber"] = item["FSrcStockId"].ToString() }); |
| | | FentityModel.Add("FQty", item["FQty"].ToString()); |
| | | Fentity.Add(FentityModel); |
| | | } |
| | | model.Add("FBillEntry", Fentity); |
| | | |
| | | JObject jsonRoot = new JObject() |
| | | { |
| | | ["Creator"] = "", |
| | | ["NeedUpDateFields"] = new JArray(), |
| | | ["NeedReturnFields"] = new JArray(), |
| | | ["IsDeleteEntry"] = "false", |
| | | ["SubSystemId"] = "", |
| | | ["IsVerifyBaseDataField"] = "false", |
| | | ["Model"] = model |
| | | }; |
| | | 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.Save("STK_TransferDirect", jsonRoot.ToString()); |
| | | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = result; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "调拨单已经存在,无法生成!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |