| | |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 入库——生产汇报单 |
| | | /// </summary> |
| | | /// <param name="InterID">工序汇报单主ID</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_ProcessMangement/SaveICMOReportBill_Batch")] |
| | | [HttpPost] |
| | | public object SaveICMOReportBill_Batch([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string InterID = sArray[0].ToString(); |
| | | string user = sArray[1].ToString(); |
| | | string BillNo = sArray[2].ToString(); |
| | | string OrganizationID = sArray[3].ToString(); |
| | | ArrayList InterIDArray = new ArrayList(InterID.Split(',')); |
| | | ArrayList BillNoArray = new ArrayList(BillNo.Split(',')); |
| | | try |
| | | { |
| | | string bResult; |
| | | string HMessage = ""; |
| | | string HSuccessBillNo = ""; |
| | | string HFailBillNo = ""; |
| | | WebAPI.Controllers.Sc_ProcessMangementController oBill = new WebAPI.Controllers.Sc_ProcessMangementController(); |
| | | if (InterIDArray.Count != BillNoArray.Count) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "数据不完整,内码数量不等于单据号数量"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < InterIDArray.Count;i++) |
| | | { |
| | | bResult = JsonConvert.SerializeObject(oBill.SaveICMOReportBill(InterIDArray[i].ToString(), user, BillNoArray[i].ToString(), OrganizationID)); |
| | | |
| | | //反序列化 |
| | | bResult = "[" + bResult.ToString() + "]"; |
| | | |
| | | List<JsonResult> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JsonResult>>(bResult); |
| | | |
| | | if (list[0].count == 1) |
| | | { |
| | | HSuccessBillNo = HSuccessBillNo + BillNoArray[i].ToString()+"," + "\r\n" ; |
| | | } |
| | | else |
| | | { |
| | | HFailBillNo = HFailBillNo + BillNoArray[i].ToString() + ":" + list[0].Message + "," + "\r\n"; |
| | | } |
| | | HMessage = "汇报成功单号:" + HSuccessBillNo + "\r\n" + " 汇报失败单号:" + HFailBillNo; |
| | | } |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = HMessage; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 入库——生产汇报单 |
| | | /// </summary> |
| | |
| | | FentityModel.Add("FFinishQty", item["接收数量"].ToString());//完成数量1 |
| | | FentityModel.Add("FQuaQty", item["合格数量"].ToString());//合格数量1FFailQty |
| | | FentityModel.Add("FFailQty", item["不良数量"].ToString());//不合格数量 |
| | | FentityModel.Add("FScrapQty", item["报废数量"].ToString());//报废数量 |
| | | FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 入库组织 |
| | | FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 仓库 |
| | | FentityModel.Add("FMOID", dr1["FMOID"].ToString());// |
| | |
| | | objJsonResult.Message = "保存成功!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 入库——生产汇报单 |
| | | /// </summary> |
| | | /// <param name="InterID">工序汇报单主ID</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_ProcessMangement/SaveProcdutInBill_Batch")] |
| | | [HttpPost] |
| | | public object SaveProcdutInBill_Batch([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string BillNo = sArray[0].ToString(); |
| | | BillNo = BillNo.Replace("\r\n", "").Replace("[ ", "").Replace("]", ""); |
| | | BillNo = BillNo.Replace("\\", "").Replace("\n", "").Replace("\"", ""); |
| | | BillNo = BillNo.Trim(); |
| | | ArrayList BillNoArray = new ArrayList(BillNo.Split(',')); |
| | | |
| | | try |
| | | { |
| | | string bResult; |
| | | string HMessage = ""; |
| | | string HSuccessBillNo = ""; |
| | | string HFailBillNo = ""; |
| | | WebAPI.Controllers.Sc_ProcessMangementController oBill = new WebAPI.Controllers.Sc_ProcessMangementController(); |
| | | |
| | | for (int i = 0; i < BillNoArray.Count; i++) |
| | | { |
| | | bResult = JsonConvert.SerializeObject(oBill.SaveProcdutInBill(BillNoArray[i].ToString().Trim())); |
| | | |
| | | //反序列化 |
| | | bResult = "[" + bResult.ToString() + "]"; |
| | | |
| | | List<JsonResult> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JsonResult>>(bResult); |
| | | |
| | | if (list[0].count == 1) |
| | | { |
| | | HSuccessBillNo = HSuccessBillNo + BillNoArray[i].ToString() + "," + "\r\n"; |
| | | } |
| | | else |
| | | { |
| | | HFailBillNo = HFailBillNo + BillNoArray[i].ToString() + ":" + list[0].Message + "," + "\r\n"; |
| | | } |
| | | HMessage = "入库成功单号:" + HSuccessBillNo + "\r\n" + " 入库失败单号:" + HFailBillNo; |
| | | } |
| | | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = HMessage; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //判断唯一ID是否为空 |
| | | foreach (DataRow item in ds1.Tables[0].Rows) |
| | | { |
| | | if (item["HWYID"].ToString() == null || item["HWYID"].ToString() == "" || item["HWYID"].ToString() == "undefined") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "唯一ID为空,请重新手动入库或联系管理员!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |