| | |
| | | public long HSTOCKID = 0;//HSTOCKID |
| | | public string éæåå { get; set; }//éæåå |
| | | public int HMaterialID = 0; //HMaterialIDCol |
| | | public string ç©æä»£ç = ""; |
| | | public string HSourceBillNo { get; set; }//HSourceBillNoCol |
| | | public int è°åºä»åºå¯ç¨åºåæ°é = 0;//HKFQtyKYCol |
| | | public int è°åºä»åºåºåæ°é = 0;//HKFQtySCol |
| | |
| | | { |
| | | if (listCa[i].HMaterialID != 0 && listCa[i].嫿æ°é > 0) |
| | | { |
| | | var Hqty = 0.0; |
| | | var TuiHqty = 0.0; |
| | | //å½å忮已嫿 å 已鿿°é |
| | | ds = oCN.RunProcReturn($@" |
| | | select isnull(a.HQty,0) 已嫿æ°é,isnull(b.HQty,0) å·²éæç³è¯·æ°é from ( |
| | | select sum(b.HQty) HQty,c.HNumber ,b.HSourceBillNo |
| | | from JIT_CallGoodsBillMain a |
| | | join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID |
| | | left join Gy_Material c on b.HMaterID=c.HItemID |
| | | where b.HSourceBillNo='{listCa[i].HSourceBillNo}' |
| | | group by c.HNumber,b.HSourceBillNo |
| | | ) a |
| | | left join ( |
| | | select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo |
| | | from JIT_CallGoodsBackRequestBillMain a |
| | | inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID |
| | | left join Gy_Material c on b.HMaterID=c.HItemID |
| | | where b.HSourceBillNo='{listCa[i].HSourceBillNo}' |
| | | group by c.HNumber,b.HSourceBillNo |
| | | ) b on a.HNumber=b.HNumber and a.HSourceBillNo=b.HSourceBillNo where a.HNumber='{listCa[i].ç©æä»£ç }'", "JIT_CallGoodsBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | Hqty = double.Parse(ds.Tables[0].Rows[0]["已嫿æ°é"].ToString()); |
| | | TuiHqty = double.Parse(ds.Tables[0].Rows[0]["å·²éæç³è¯·æ°é"].ToString()); |
| | | } |
| | | |
| | | if (listCa[i].嫿æ°é > listCa[i].计ååææ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa[i].åºåæ°é == 0 && listCa[i].嫿æ°é > 0) |
| | | if((listCa[i].嫿æ°é + Hqty - TuiHqty)> listCa[i].计ååææ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å«ææ»æ°é大äºè®¡ååææ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where ä»åºID=" + listCa[i].è°åºä»åºid + " and ç©æç¼ç = '" + listCa[i].ç©æä»£ç + "' and åºåç»ç»=" + listCa[i].HOutOrgID, "h_v_JIT_WarehouseList"); |
| | | |
| | | var HSCWHIDCount= double.Parse(ds.Tables[0].Rows[0]["è°åºä»åºå¯ç¨åºåæ°é"].ToString()); |
| | | |
| | | if (HSCWHIDCount == 0 && listCa[i].嫿æ°é > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa[i].嫿æ°é > listCa[i].åºåæ°é) |
| | | if (listCa[i].嫿æ°é > HSCWHIDCount) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //if (listCa[i].è°åºä»åºå¯ç¨åºåæ°é == 0) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "è°åºä»åºå¯ç¨åºåæ°é为0!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | j = 1; |
| | | |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | DBUtility.ClsPub.CurUserName = sArray[1].ToString(); |
| | | string HOrgID = sArray[2].ToString(); |
| | | bool flag = false; |
| | | json flag =new json(); |
| | | |
| | | try |
| | | { |
| | |
| | | { |
| | | if (listCa[i].éææ°é > 0) |
| | | { |
| | | if (listCa[i].éææ°é > listCa[i].å·²é
éæ°é&& listCa[i].å·²é
éæ°é>0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "éææ°é大äºå·²é
éæ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select isnull(sum(d.HQty),0) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " + |
| | | $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()==""?"0": ds.Tables[0].Rows[0][0].ToString()) +listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"å·²ç»éææ°é:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},å¯éææ°é为:{(listCa[i].已嫿æ°é - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa[i].è°å
¥ä»åºid == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¯·éæ©è°å
¥ä»åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa[i].è°åºä»åºid == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¯·éæ©è°åºä»åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | flag = AddICStockTuiBill(listCa[i], "666601", "ä¸è¯åéæ", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | flag = (json)AddICStockTuiBill(listCa[i], "666601", "ä¸è¯åéæ", HOrgID); |
| | | j = 1; |
| | | |
| | | if (flag.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | if (j == 0) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (flag) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¸è¯åéææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¸è¯åéæå¤±è´¥!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¸è¯åéææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | |
| | | //æ°å¢ |
| | | public bool AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID, ref string sReturn) |
| | | public object AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | |
| | | if (listCa.éææ°é > listCa.å·²é
éæ°é && listCa.å·²é
éæ°é > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "éææ°é大äºå·²é
éæ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa.è°å
¥ä»åºid == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¯·éæ©è°å
¥ä»åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (listCa.è°åºä»åºid == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¯·éæ©è°åºä»åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var THqty = 0.0; |
| | | ds = oCN.RunProcReturn($@" |
| | | select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo |
| | | from JIT_CallGoodsBackRequestBillMain a |
| | | inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID |
| | | left join Gy_Material c on b.HMaterID=c.HItemID |
| | | where c.HNumber='{listCa.ç©æä»£ç }' and b.HSourceBillNo='{listCa.HSourceBillNo}' |
| | | group by c.HNumber,b.HSourceBillNo |
| | | ", "JIT_CallGoodsBackRequestBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | THqty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString()); |
| | | } |
| | | |
| | | if ((listCa.éææ°é + THqty) > listCa.å·²é
éæ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç´¯è®¡éææ°é大äºå·²é
éæ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | Int64 lngBillKey = listCa.HSouceInterID == 0 ? 0 : listCa.HSouceInterID; |
| | | Int64 lngBillKeyEntry = listCa.HSourceEntryID == 0 ? 0 : listCa.HSourceEntryID; |
| | | double HQty = (double)(listCa.éææ°é == 0 ? 0 : listCa.éææ°é); |
| | |
| | | $" '{HBillType}','{DateTime.Now}','{HBillNo}',{HOrgID},'{ DBUtility.ClsPub.CurUserName}','{DateTime.Now}','','',0,0,0,''," + |
| | | $" 0, 0, {listCa.HOutOrgID}, {HOrgID}, 0,'{HBackType}')"); |
| | | |
| | | sReturn = "æ°å¢åæ®æåï¼"; |
| | | oCN.Commit(); |
| | | return true; |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.Message = "æ°å¢åæ®æåï¼"; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sReturn = e.Message; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.Message = e.Message; ; |
| | | return objJsonResult; |
| | | throw (e); |
| | | } |
| | | } |
| | |
| | | List<CallGoodsBill> listCa = new List<CallGoodsBill>(); |
| | | //è·åè¡¨æ ¼æ°æ®éå |
| | | listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString()); |
| | | bool flag = false; |
| | | json flag = new json(); |
| | | |
| | | int j = 0; |
| | | for (int i = 0; i < listCa.Count; i++) |
| | | { |
| | | if (listCa[i].éææ°é > 0) |
| | | { |
| | | if (listCa[i].éææ°é > listCa[i].å·²é
éæ°é && listCa[i].å·²é
éæ°é > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "éææ°é大äºå·²é
éæ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " + |
| | | $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"å·²ç»éææ°é:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},å¯éææ°é为:{(listCa[i].已嫿æ°é - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | flag = AddICStockTuiBill(listCa[i], "666602", " ä½ééæ", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | flag =(json)AddICStockTuiBill(listCa[i], "666602", " ä½ééæ", HOrgID); |
| | | j = 1; |
| | | if (flag.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | if (j == 0) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (flag) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä½ééææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä½ééæå¤±è´¥!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä½ééææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | //è·åè¡¨æ ¼æ°æ®éå |
| | | listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString()); |
| | | |
| | | bool flag = false; |
| | | json flag = new json(); |
| | | int j = 0; |
| | | for (int i = 0; i < listCa.Count; i++) |
| | | { |
| | | if (listCa[i].éææ°é > 0) |
| | | { |
| | | if (listCa[i].éææ°é > listCa[i].å·²é
éæ°é && listCa[i].å·²é
éæ°é > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "éææ°é大äºå·²é
éæ°é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " + |
| | | $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"å·²ç»éææ°é:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},å¯éææ°é为:{(listCa[i].已嫿æ°é - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | flag = AddICStockTuiBill(listCa[i], "666603", "æ¥åºéæ", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | flag =(json) AddICStockTuiBill(listCa[i], "666603", "æ¥åºéæ", HOrgID); |
| | | j = 1; |
| | | if (flag.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | if (j == 0) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (flag) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ¥åºéææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥åºéæå¤±è´¥!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ¥åºéææå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region çäº§å«æå¹³å° ä»åºåºåå表 |
| | | |
| | | [Route("Sc_ComplementGoodBill/GetWarehouseList_JIT")] |
| | | [HttpGet] |
| | | public object GetWarehouseList_JIT(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where 1=1 "+ sWhere, "h_v_JIT_WarehouseList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region çäº§å«æå¹³å° æªçææ£æç³è¯·å æªçæéæå |
| | | [Route("Sc_ComplementGoodBill/NotGeneratedMaterialList")] |
| | | [HttpGet] |
| | | public object NotGeneratedMaterialList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | //æ¥è¯¢å«æå æªçæ æ£æå çæ¡æ° |
| | | //æ¥è¯¢éæç³è¯·å æªçæ éæåç æ¡æ° |
| | | ds = oCN.RunProcReturn($@"select count(*) æªçæ from JIT_CallGoodsBackRequestBillMain as a |
| | | inner join JIT_CallGoodsBackRequestBillSub as b on a.HInterID=b.HInterID |
| | | where a.HISCheck =0 and a.HOrgID={sWhere} |
| | | and a.HMaker = '{user}' |
| | | union all |
| | | select count(*) æªçæ from JIT_CallGoodsBillMain a |
| | | join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID |
| | | where b.HPSQty=0 and a.HOrgID={sWhere} |
| | | and a.HMaker = '{user}'", "JIT_CallGoodsBackRequestBillMain"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |