| | |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | |
| | | private json objJsonResult = new json(); |
| | | |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | |
| | | // model.Add("FBillType", new JObject() { ["Fnumber"] = "SCHBD01_SYS" }); //单据类型生产汇报“SCHBD02_SYS” 入库汇报SCHBD01_SYS |
| | | // model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //生产组织1 |
| | | // model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //单据日期1 |
| | | // model.Add("FHZYMESFLAG", "是");// 是否为MES同步 |
| | | // model.Add("FBillNo", BillNo); |
| | | |
| | | // JArray Fentity = new JArray(); |
| | |
| | | // FentityModel.Add("FFailQty", item["不良数量"].ToString());//不合格数量 |
| | | // FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 入库组织 |
| | | // FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 仓库 |
| | | // FentityModel.Add("FMOID", dr1["FMOID"].ToString());// |
| | | // FentityModel.Add("FMOBILLNO", dr1["FMOBILLNO"].ToString());// |
| | | // FentityModel.Add("FMOENTRYID", dr1["FMOENTRYID"].ToString());// |
| | | // FentityModel.Add("FMOENTRYSEQ", dr1["FMOENTRYSEQ"].ToString());// |
| | | // FentityModel.Add("FOwnerTypeId", dr1["FOWNERTYPEID"].ToString()); //货主类型:FOwnerTypeId(必填项) |
| | | // FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = dr1["FOwnerNumber"].ToString() }); //货主:FOwnerId(必填项) |
| | | // FentityModel.Add("FBomId", new JObject() { ["Fnumber"] = dr1["FBOMNUM"].ToString() }); //BOM版本:FBomId(必填项) |
| | | // FentityModel.Add("FBomId", new JObject() { ["F number"] = dr1["FBOMNUM"].ToString() }); //BOM版本:FBomId(必填项) |
| | | // FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 成本权重 |
| | | // FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 倒冲领料 |
| | | // FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// |
| | | // FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 |
| | | // FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //批号 |
| | | // FentityModel.Add("F_bsv_Text", dr1["工序流转卡号"].ToString()); //流转卡号 |
| | | // JArray Fentity2 = new JArray(); |
| | | // JObject FentityModel2 = new JObject(); |
| | | // FentityModel2.Add("FEntity_Link_FFlowId", "f6e6eec3-5267-4f02-8593-b633da508a72"); |
| | |
| | | // FentityModel2.Add("FEntity_Link_FBaseQuaQtyOld", item["合格数量"].ToString()); |
| | | // FentityModel2.Add("FEntity_Link_FBaseQuaQty", item["合格数量"].ToString()); |
| | | // Fentity2.Add(FentityModel2); |
| | | // FentityModel.Add("FEntity_Link", Fentity2); |
| | | // FentityModel.Add("FBFLowId", new JObject() { ["FID"] = "f6e6eec3-5267-4f02-8593-b633da508a72" }); // |
| | | // Fentity.Add(FentityModel); |
| | | // } |
| | | // model.Add("FEntity", Fentity); //明细信息 |
| | | // JObject jsonRoot = new JObject() |
| | |
| | | string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); |
| | | //根据工序汇报单主ID获取工序汇报入库单的数据 |
| | | DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); |
| | | if(ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "生成生产汇报单过程中没有查询到出站单"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DataRow dr = ds.Tables[0].Rows[0]; |
| | | |
| | | //保存 |
| | |
| | | FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 成本权重 |
| | | FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 倒冲领料 |
| | | FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// |
| | | FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 |
| | | //FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //批号 |
| | | FentityModel.Add("F_bsv_Text", dr1["工序流转卡号"].ToString()); //流转卡号 |
| | | JArray Fentity2 = new JArray(); |
| | |
| | | ////根据工序汇报单主ID获取工序汇报入库单的数据 |
| | | //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); |
| | | //DataRow dr = ds.Tables[0].Rows[0]; |
| | | |
| | | //判断入库的合格数量是否为0 |
| | | var DTable = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HBillNo='"+ BillNo + "' ", "Sc_StationOutBillMain").Tables[0]; |
| | | |
| | | if (double.Parse(DTable.Rows[0]["HQty"].ToString()) == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 2; |
| | | objJsonResult.Message = "合格数量为0,不需要入库!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | oCN.BeginTran(); |
| | | //生产汇报单主表 |
| | |
| | | //DataSet ds1 = oCN.RunProcReturn("select * from h_v_TOERPProcduct_LastProc where HLastProc = '是' and hbillno='" + BillNo.ToString() + "'", "h_v_TOERPProcduct_LastProc"); |
| | | DataSet ds1 = oCN.RunProcReturn("exec h_p_TOERPProcduct_LastProc '" + BillNo + "'", "h_p_TOERPProcduct_LastProc"); |
| | | DataRow dr1 = ds1.Tables[0].Rows[0]; |
| | | if (ds1.Tables[0].Rows.Count <= 0) |
| | | if (double.Parse(dr1[0].ToString()) <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | FentityModel.Add("FBaseRealQty", item["数量"].ToString());// |
| | | FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// |
| | | FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺") |
| | | { |
| | | if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工艺路线") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 仓库 |
| | | } |
| | | else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工序") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | } |
| | | } |
| | | } |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //批号 |
| | | FentityModel.Add("FISBACKFLUSH", "true");// |
| | | FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 生产车间 |
| | |
| | | ////根据工序汇报单主ID获取工序汇报入库单的数据 |
| | | //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); |
| | | //DataRow dr = ds.Tables[0].Rows[0]; |
| | | |
| | | //判断本次报废总数量是否为0 |
| | | var DTable = oCN.RunProcReturn("select isnull(sum(HWasterQty),0) HWasterQty from Sc_StationOutBillMain where HProcExchBillNo='"+ BillNo + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0]; |
| | | |
| | | if (double.Parse(DTable.Rows[0]["HWasterQty"].ToString()) == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 2; |
| | | objJsonResult.Message = "报废数量为0,不需要入库!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //保存 |
| | | oCN.BeginTran(); |
| | | //生产汇报单主表 |
| | |
| | | FentityModel.Add("FBaseRealQty", item["数量"].ToString());// |
| | | FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// |
| | | FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺") |
| | | { |
| | | if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工艺路线") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 仓库 |
| | | } |
| | | else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工序") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | } |
| | | } |
| | | } |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //批号 |
| | | FentityModel.Add("FISBACKFLUSH", "true");// |
| | | FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 生产车间 |
| | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 生成金蝶云来料检验单 |
| | | /// </summary> |
| | | /// <param name="InterID">工序汇报单主ID</param> |
| | | /// <returns></returns> |
| | | [Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")] |
| | | [HttpGet] |
| | | public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber, |
| | | double HCheckQty, double HRightQty, double HBadQty, |
| | | string HCheckResult, string HSupNumber, |
| | | string HUseResult, Int64 HSeQ, Int64 HSourceInterID, |
| | | Int64 HSourceEntryID, string HSourceBillNo, string user, |
| | | Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, |
| | | Int64 HMaterID, string HSourceBillType, Int64 HSLInterID, |
| | | Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID,ref string sErrMsg) |
| | | { |
| | | WebS2.WebService1 oWebs1 = new WebS2.WebService1(); |
| | | ///// <summary> |
| | | ///// 生成金蝶云来料检验单 |
| | | ///// </summary> |
| | | ///// <param name="InterID">工序汇报单主ID</param> |
| | | ///// <returns></returns> |
| | | //[Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")] |
| | | //[HttpGet] |
| | | //public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber, |
| | | // double HCheckQty, double HRightQty, double HBadQty, |
| | | // string HCheckResult, string HSupNumber, |
| | | // string HUseResult, Int64 HSeQ, Int64 HSourceInterID, |
| | | // Int64 HSourceEntryID, string HSourceBillNo, string user, |
| | | // Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, |
| | | // Int64 HMaterID, string HSourceBillType, Int64 HSLInterID, |
| | | // Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID,ref string sErrMsg) |
| | | //{ |
| | | // WebS.WebService1 oWebs1 = new WebS.WebService1(); |
| | | |
| | | |
| | | //oWebs1.Url = "http://localhost:9099/WebService1.asmx"; |
| | | //K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/"); |
| | | if (oWebs1.set_SaveQcStockInCheckBill_New(HZJOrgNumber, HMaterNumber, HUnitNumber, HCheckQty, HRightQty, HBadQty |
| | | , HCheckResult, HSupNumber, HUseResult, HSeQ, HSourceInterID |
| | | , HSourceEntryID, HSourceBillNo, user, HWHID, HSPID |
| | | , HSupID, HKeeperID, HMaterID, HSourceBillType, HSLInterID |
| | | , HSLEntryID, HSLBillNo, HSLSeQ, HBillNo, HInterID |
| | | , ref sErrMsg)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "生成单据成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "生成单据失败!"; |
| | | objJsonResult.data = sErrMsg; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | // //oWebs1.Url = "http://localhost:9099/WebService1.asmx"; |
| | | // //K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/"); |
| | | // if (oWebs1.set_SaveQcStockInCheckBill_New(HZJOrgNumber, HMaterNumber, HUnitNumber, HCheckQty, HRightQty, HBadQty |
| | | // , HCheckResult, HSupNumber, HUseResult, HSeQ, HSourceInterID |
| | | // , HSourceEntryID, HSourceBillNo, user, HWHID, HSPID |
| | | // , HSupID, HKeeperID, HMaterID, HSourceBillType, HSLInterID |
| | | // , HSLEntryID, HSLBillNo, HSLSeQ, HBillNo, HInterID |
| | | // , ref sErrMsg)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 1; |
| | | // objJsonResult.Message = "生成单据成功!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | // else |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "生成单据失败!"; |
| | | // objJsonResult.data = sErrMsg; |
| | | // return objJsonResult; |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | |