| | |
| | | if (!tb2.Columns.Contains("状态")) |
| | | error += "没有找到【状态】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("默认仓库")) |
| | | error += "没有找到【默认仓库】的标题,"; |
| | | //if (!tb2.Columns.Contains("默认仓库")) |
| | | // error += "没有找到【默认仓库】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("默认仓位")) |
| | | error += "没有找到【默认仓位】的标题,"; |
| | | //if (!tb2.Columns.Contains("默认仓位")) |
| | | // error += "没有找到【默认仓位】的标题,"; |
| | | |
| | | if (!tb2.Columns.Contains("版本号")) |
| | | error += "没有找到【版本号】的标题,"; |
| | |
| | | HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["对应ERP物料"].ToString()); |
| | | HUnitName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["计量单位"].ToString()); |
| | | HDeptName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["使用部门"].ToString()); |
| | | HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["默认仓库"].ToString()); |
| | | HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["默认仓位"].ToString()); |
| | | HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["默认仓库"].ToString()); |
| | | HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["默认仓位"].ToString()); |
| | | HSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["供应商"].ToString()); |
| | | HSupNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["供应商代码"].ToString()); |
| | | HMadeSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["制造商"].ToString()); |
| | |
| | | { |
| | | tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | //查询仓库 |
| | | ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse"); |
| | | if (HWHName != "") |
| | | { |
| | | //查询仓库 |
| | | ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓库:" + HWHName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HSPGroupID"].ToString(); |
| | | } |
| | | string HWHID = tb2.Rows[i]["HWHID"].ToString(); |
| | | //查询仓位 |
| | | ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID+ " and HUSEORGID=" + HORGid + "", "Gy_StockPlace"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓库:" + HWHName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | |
| | | string HWHID = tb2.Rows[i]["HWHID"].ToString(); |
| | | if (HWHID != "") |
| | | { |
| | | //查询仓位 |
| | | ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID + " and HUSEORGID=" + HORGid + "", "Gy_StockPlace"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓位:" + HSPName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,仓位:" + HSPName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | if(HSupName!="") |
| | | { |
| | | tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,供应商:" + HSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | //查询供应商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | if(HMadeSupName!="") |
| | | { |
| | | //查询制造商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,供应商:" + HSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,制造商:" + HMadeSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | //查询制造商 |
| | | ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "行,该" + HORGName + "组织,制造商:" + HMadeSupName + ",不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | |
| | | |
| | | |
| | | //器具档案名称 |
| | | if (HMouldName == "") |
| | |
| | | long HUnitID = int.Parse(item["HUnitID"].ToString()); |
| | | DateTime HOutComDate = DateTime.Now; |
| | | string HOutComNo = item["器具出厂编号"].ToString(); |
| | | long HDeptID = int.Parse(item["HDeptID"].ToString()); |
| | | long HSupID = int.Parse(item["HSupID"].ToString()); |
| | | var HDeptID_temp = item["HDeptID"].ToString() == "" ? "0" : item["HDeptID"].ToString(); |
| | | long HDeptID = int.Parse(HDeptID_temp); |
| | | var HSupID_temp = item["HSupID"].ToString() == "" ? "0" : item["HSupID"].ToString(); |
| | | long HSupID = int.Parse(HSupID_temp); |
| | | string HMouldStatus = item["状态"].ToString(); |
| | | long HWHID = int.Parse(item["HWHID"].ToString()); |
| | | var HWHID_TEMP = item["HWHID"].ToString() == "" ? "0" : item["HWHID"].ToString(); |
| | | long HWHID = int.Parse(HWHID_TEMP); |
| | | long HRoutingID = 0;//工艺路线id |
| | | long HBOMID = 0; |
| | | string HVersion = "";//版本 |
| | | long HSPGroupID = 0;//默认仓位组 |
| | | long HSPID = int.Parse(item["HSPID"].ToString());//仓位id |
| | | var HSPID_temp = item["HSPID"].ToString() == "" ? "0" : item["HSPID"].ToString(); |
| | | long HSPID = int.Parse(HSPID_temp);//仓位id |
| | | Double HDesignLife = item["设计寿命"].ToString()=="" ? 0: double.Parse(item["设计寿命"].ToString()); |
| | | Double HUseLife = item["使用寿命"].ToString() == "" ? 0 : double.Parse(item["使用寿命"].ToString()); |
| | | Double HInitLife = 0;//上线初始化寿命 |
| | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | //根据条码找物料信息 |
| | | [Route("Gy_Material/findMaterialByNumber")] |
| | | [HttpGet] |
| | | public object findMaterialByNumber(string HbarCode,string HSTOCKORGID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "成功"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "初始化失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | } |