|  |  |  | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'", "h_p_JIT_ComplementGoodsBillList_Query"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataSet dsTable = new DataSet(); | 
|---|
|  |  |  | //查询JIT_ComplementGoodsBillSub_LK | 
|---|
|  |  |  | dsTable = oCN.RunProcReturn($"select  * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID}  and HInterID={SourceInterID} order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK"); | 
|---|
|  |  |  | dsTable = oCN.RunProcReturn($"select  * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID}  and HInterID={SourceInterID} and HCallQTY<>HSendQTY  order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var HqtyCount = double.Parse(listCa[i].本次拣料数量.ToString()); | 
|---|
|  |  |  | for (int j = 0; j < dsTable.Tables[0].Rows.Count; j++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) != double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString())) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()) + listCa[i].本次拣料数量 > double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString())) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()); | 
|---|
|  |  |  | //修改调拨数量 超出部分给予下一列数据 | 
|---|
|  |  |  | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{HCallQTY} where HMaterID={listCa[i].HMaterID} " + | 
|---|
|  |  |  | $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} "); | 
|---|
|  |  |  | var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(listCa[i].本次拣料数量 - HCallQTY)} where HMaterID={listCa[i].HMaterID} " + | 
|---|
|  |  |  | $" and HSourceInterID={dsTable.Tables[0].Rows[j + 1]["HSourceInterID"].ToString()} and HInterID={SourceInterID} "); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //修改调拨数量 | 
|---|
|  |  |  | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].本次拣料数量} where HMaterID={listCa[i].HMaterID} " + | 
|---|
|  |  |  | $" and HSourceInterID={dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString()} and HInterID={SourceInterID} "); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //修改调拨数量 | 
|---|
|  |  |  | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(HCallQTY < HqtyCount ? HCallQTY : HqtyCount)} where HMaterID={listCa[i].HMaterID} " + | 
|---|
|  |  |  | $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HqtyCount -= HCallQTY; | 
|---|
|  |  |  | if (HqtyCount <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = e.Message; | 
|---|
|  |  |  | objJsonResult.Message = objJsonResult.Message; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | throw (e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec JIT_SendGoodsBillSynChronizAtion '" + HBillNo + "'", "JIT_SendGoodsBillSynChronizAtion"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (DataRow dr in ds.Tables[0].Rows) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | JObject model = new JObject(); | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var result = InvokeHelper.Save("STK_TransferDirect", jsonRoot.ToString()); | 
|---|
|  |  |  | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var json = new | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Numbers = HBillNo, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | //提交 | 
|---|
|  |  |  | var _result = InvokeHelper.Submit("STK_TransferDirect", JsonConvert.SerializeObject(json)); | 
|---|
|  |  |  | var _saveObj = JObject.Parse(_result); | 
|---|
|  |  |  | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | LogService.Write("收料通知单提交失败jsonRoot:" + jsonRoot.ToString()); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "金蝶收料通知单提交失败" + _result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //审核 | 
|---|
|  |  |  | _result = InvokeHelper.Audit("STK_TransferDirect", JsonConvert.SerializeObject(json)); | 
|---|
|  |  |  | _saveObj = JObject.Parse(_result); | 
|---|
|  |  |  | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | LogService.Write("收料通知单审核失败jsonRoot:" + jsonRoot.ToString()); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "金蝶收料通知单审核失败jsonRoot" + _result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "操作成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|