wtt
2025-11-11 170dc25004f6d0a22add0d71fdec602545902999
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -4377,11 +4377,11 @@
                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 += "没有找到【版本号】的标题,";
@@ -4534,6 +4534,8 @@
                        {
                            tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        if (HWHName != "")
                        {
                        //查询仓库
                        ds = oCN.RunProcReturn("select * from Gy_Warehouse where  HName='" + HWHName + "'  and HUSEORGID=" + HORGid + "", "Gy_Warehouse");
@@ -4547,9 +4549,12 @@
                        }
                        else
                        {
                            tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HSPGroupID"].ToString();
                                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");
@@ -4565,7 +4570,11 @@
                        {
                            tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        //查询供应商
                            }
                        }
                       if(HSupName!="")
                        {
                        ds = oCN.RunProcReturn("select * from Gy_Supplier where  HNumber='" + HSupNumber + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
                        if (ds.Tables[0].Rows.Count == 0)
@@ -4580,6 +4589,10 @@
                        {
                            tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        }
                        //查询供应商
                       if(HMadeSupName!="")
                        {
                        //查询制造商
                        ds = oCN.RunProcReturn("select * from Gy_Supplier where  HName='" + HMadeSupName + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
@@ -4595,6 +4608,9 @@
                        {
                            tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        }
                        //器具档案名称
                        if (HMouldName == "")
@@ -4704,15 +4720,19 @@
                    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;//上线初始化寿命
@@ -4855,5 +4875,30 @@
        #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;
            }
        }
    }
}