|  |  |  | 
|---|
|  |  |  | using DBUtility; | 
|---|
|  |  |  | using Model; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using SQLHelper; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //[Route("POStockInBillList/confirm")] | 
|---|
|  |  |  | //public object confirm(string hmainid) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | 
|---|
|  |  |  | //            FentityModel.Add("FSRCENTRYID", item["FHPOOrderEntryID"].ToString());//源单分录内码 | 
|---|
|  |  |  | //            FentityModel.Add("FORDERBILLNO", item["FHPOOrderBillNo"].ToString());//源单单号 | 
|---|
|  |  |  | //            FentityModel.Add("FPOORDERENTRYID", item["FHPOOrderEntryID"].ToString());//源单分录内码 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //            JArray Fentity2 = new JArray(); | 
|---|
|  |  |  | //            JObject FentityModel2 = new JObject(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region [收料通知单审核] | 
|---|
|  |  |  | //收料通知单审核 扫条码 | 
|---|
|  |  |  | [Route("POStockInBillList/Get_ReciveBillCheckDate")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Get_ReciveBillCheckDate(string HBarCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet Ds = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Temp_Add_POInStockCheck2 '" + HBarCode + "'", "h_p_KF_PonderationBillMain_Temp_Add_POInStockCheck2"); | 
|---|
|  |  |  | if (Ds == null || Ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = Ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //收料通知单审核 审核提交 | 
|---|
|  |  |  | [Route("POStockInBillList/Exec_ReciveBillCheck")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Exec_ReciveBillCheck(string HBarCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //修改金蝶生产单的状态 | 
|---|
|  |  |  | //访问金蝶 | 
|---|
|  |  |  | 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 json = new | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //CreateOrgId = 0, | 
|---|
|  |  |  | Numbers = HBarCode, | 
|---|
|  |  |  | //Ids = (EntyID).Split('-')[0], | 
|---|
|  |  |  | //PkEntryIds = (EntyID).Split('-')[1] | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | string result1 = string.Empty; | 
|---|
|  |  |  | string result2 = string.Empty; | 
|---|
|  |  |  | DataSet Ds = oCn.RunProcReturn("select FDOCUMENTSTATUS,FID from  AIS20210811135644..T_PUR_RECEIVE where FBILLNO='" + HBarCode+"'", "AIS20210811135644..T_PUR_RECEIVE"); | 
|---|
|  |  |  | //判断当前收料通知单状态——已创建则先提交再审核、以提交则只审核 | 
|---|
|  |  |  | if (Ds.Tables[0].Rows[0][0].ToString() == "A"|| Ds.Tables[0].Rows[0][0].ToString() == "D") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | result1 = InvokeHelper.Submit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); | 
|---|
|  |  |  | result2 = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Ds.Tables[0].Rows[0][0].ToString() == "B") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | result2 = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断审核是否成功 | 
|---|
|  |  |  | if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核收料通知单失败!单据号:" + HBarCode; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|