| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | [Route("POStockInBill/Delete_Json")] |
| | | [HttpGet] |
| | | public object Delete_Json(long HInterID, long HMaterID, long HAuxPropID, string HMTONo, long HSourceInterID, long HSourceEntryID, string sHBillType) |
| | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!"; |
| | |
| | | return HInterID; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 到货确认扫收料通知单号 获取表体和表头数据 |
| | | /// </summary> |
| | | /// <param name="HBarCode"></param> |
| | | /// <returns></returns> |
| | | public json Get_ReciveBillCheckDate(string HBarCode) |
| | | { |
| | | json objjson = new json(); |
| | |
| | | } |
| | | } |
| | | |
| | | [Route("POStockInBillList/AuditPOInStockBillPost")] |
| | | [HttpPost] |
| | | public object AuditPOInStockBill([FromBody] JObject msg) |
| | | { |
| | | try |
| | | { |
| | | string _msg = msg["msg"].ToString(); |
| | | _msg = _msg.Replace("\\", ""); |
| | | _msg = _msg.Replace("\n", ""); |
| | | List<Models.ReciveBill_FastModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ReciveBill_FastModel>>(_msg); |
| | | DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill(); |
| | | var hinterID = list[0].HInterID; |
| | | var FID = list[0].FID; |
| | | |
| | | #region 校验是否扫描条码 |
| | | var HInterID = list[0].HInterID; |
| | | string jysql = string.Format(@"select * from KF_PonderationBillMain_Temp where HSourceInterID = {0}", HInterID); |
| | | DataTable jyDt =oCn.RunProcReturn(jysql, "jysql").Tables[0]; |
| | | if (jyDt.Rows.Count == 0 || jyDt == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "请扫描条码"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | #region 金蝶审核后会重新同步单据到mes 故不需要更新mes的收料通知单 |
| | | /* |
| | | oCn.BeginTran(); |
| | | string sql = string.Empty; |
| | | |
| | | foreach (var item in list) |
| | | { |
| | | if (item.HSQty == 0) |
| | | continue; |
| | | sql = $"update Cg_POInStockBillSub set Hqty = {item.HSQty} where HInterID ={item.HInterID} and HEntryID = {item.HEntryID}"; |
| | | oCn.RunProc(sql); |
| | | } |
| | | oCn.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + hinterID);//删除关联关系 |
| | | sql = string.Format(@"update Cg_POInStockBillMain set |
| | | HBillStatus = 2 , |
| | | HCheckDate = getdate() |
| | | where HInterID in ({0})", HInterID); |
| | | oCn.RunProc(sql);//更新mes状态 |
| | | //更新成功后 同步更新金蝶 |
| | | oCn.Commit(); |
| | | **/ |
| | | #endregion |
| | | |
| | | JObject jsonRoot = new JObject(); |
| | | jsonRoot.Add("Creator", ""); |
| | | jsonRoot.Add("NeedUpDateFields", new JArray()); |
| | | jsonRoot.Add("NeedReturnFields", new JArray()); |
| | | jsonRoot.Add("IsDeleteEntry", "false"); |
| | | jsonRoot.Add("SubSystemId", ""); |
| | | jsonRoot.Add("IsVerifyBaseDataField", ""); |
| | | |
| | | JObject jsonModel = new JObject(); |
| | | jsonModel.Add("FID", FID); |
| | | JArray Entry = new JArray(); |
| | | foreach (var item in list) |
| | | { |
| | | if (item.HSQty == 0) |
| | | continue; |
| | | JObject jsonFPOOrderEntry = new JObject(); |
| | | jsonFPOOrderEntry.Add("FEntryID", item.FEntryID); |
| | | jsonFPOOrderEntry.Add("FActReceiveQty ", item.HSQty); ; |
| | | Entry.Add(jsonFPOOrderEntry); |
| | | } |
| | | jsonModel.Add("FDetailEntity", Entry); |
| | | jsonRoot.Add("Model", jsonModel); |
| | | 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("PUR_ReceiveBill", jsonRoot.ToString()); |
| | | //LogService.Write(result); |
| | | if (JObject.Parse(result)["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; |
| | | } |
| | | var json = new |
| | | { |
| | | Ids = FID, |
| | | }; |
| | | //提交 |
| | | var _result = InvokeHelper.Submit("PUR_ReceiveBill", 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("PUR_ReceiveBill", 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; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //oCn.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 到货确认 扫条码 校验 |
| | | /// </summary> |
| | | /// <param name="HBarcode"></param> |
| | | /// <param name="HInterID"></param> |
| | | /// <returns></returns> |
| | | [Route("POStockInBillList/Get_ReciveBillByBarcode")] |
| | | [HttpGet] |
| | | public object Get_ReciveBillByBarcode(string HBarcode, string HInterID) |
| | | { |
| | | try |
| | | { |
| | | //var code = HBarcode.Split('#')[0]; |
| | | //校验条码是否存在 |
| | | string sql = $"select HItemID,HSourceBillNo from Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode.Split('#')[0]}' and HQty = {HBarcode.Split('#')[1]}"; |
| | | DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码不存在!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | //存入条码临时表 |
| | | sql = $"delete from KF_PonderationBillMain_Temp Where HBillNo='{ds.Tables[0].Rows[0]["HSourceBillNo"]}' "; |
| | | oCn.RunProc(sql); |
| | | sql = string.Format(@"Insert into KF_PonderationBillMain_Temp |
| | | (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID |
| | | ,HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty |
| | | ,HAuxPropID,HBatchNo,HBarCode,HAddr,HMaker,HMakeDate |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo |
| | | ,HSTOCKORGID,HOWNERID,HExpressNumber,HSubBillType |
| | | ,HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag |
| | | ,HCusID) |
| | | select HInterID,HSourceBillNo,HBillType,HMaterID,0,0,0 |
| | | ,0,0,0,HQty,HQty,0 |
| | | ,HAuxPropID,HBatchNo,'','','System',getdate() |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo |
| | | ,HSTOCKORGID,HOWNERID,'',HBillType |
| | | ,0,0,'',0 |
| | | ,0 from Gy_BarCodeBill |
| | | where HItemID = {0}", ds.Tables[0].Rows[0]["HItemID"]); |
| | | oCn.RunProc(sql); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //string sql = $"select * from H_v_SRM_POInStockBillList where 单据号 ='{HBillno}'"; |
| | | //ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList"); |
| | | //if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "没有返回任何记录!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | |
| | | //} |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //收料通知单审核 审核提交 |
| | | [Route("POStockInBillList/Exec_ReciveBillCheck")] |
| | | [HttpGet] |