yangle
2023-02-08 1d47cda889c0408d2fe885fc99727e85c591764c
WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/JIT_DayPlanPlatFormImportController.cs
@@ -59,6 +59,7 @@
                tb2.Columns.Add("HSourceID", typeof(Int32));//生产资源id
                tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//生产订单主id
                tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//生产订单子id
                tb2.Columns.Add("HProdORGID", typeof(Int32));//组织id
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
@@ -151,18 +152,60 @@
                    {
                        //员工
                        ds = oCN.RunProcReturn($"select * from Gy_Employee  where HNumber='{tb2.Rows[i]["员工编码"].ToString()}'", "Gy_Employee");
                        if (ds.Tables[0].Rows.Count > 0)
                        if (ds.Tables[0].Rows.Count > 0) {
                            tb2.Rows[i]["员工编码"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = $"第{i + 1}行,员工查无数据!";
                            objJsonResult.data = tb2;
                            return objJsonResult;
                        }
                        //计量单位
                        ds = oCN.RunProcReturn($"select * from Gy_Unit  where HNumber='{tb2.Rows[i]["计量单位"].ToString()}'", "Gy_Unit");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            tb2.Rows[i]["HUnitID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = $"第{i + 1}行,计量单位查无数据!";
                            objJsonResult.data = tb2;
                            return objJsonResult;
                        }
                        //生产资源
                        ds = oCN.RunProcReturn($"select * from Gy_Source  where HNumber='{tb2.Rows[i]["生产资源编码*"].ToString()}'", "Gy_Source");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            tb2.Rows[i]["HSourceID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        else {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = $"第{i+1}行,生产资源查无数据!";
                            objJsonResult.data = tb2;
                            return objJsonResult;
                        }
                    }
                    //组织
                    ds = oCN.RunProcReturn($"select * from Xt_ORGANIZATIONS  where HNumber='{tb2.Rows[i]["组织编码*"].ToString()}'", "Xt_ORGANIZATIONS");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        tb2.Rows[i]["HProdORGID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = $"第{i + 1}行,组织查无数据!";
                        objJsonResult.data = tb2;
                        return objJsonResult;
                    }
                }
@@ -257,7 +300,7 @@
                        HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//获得一个新的id
                        var HICMOBillNo = list[i]["生产订单号*"].ToString();
                        var HICMOEntrySEQ = list[i]["生产订单明细行号*"].ToString();
                        var HProdORGID = list[i]["组织编码*"].ToString();
                        var HProdORGID = list[i]["HProdORGID"].ToString();
                        var HWorkShopID = list[i]["HWorkShopID"].ToString();
                        var HSourceID = list[i]["HSourceID"].ToString();
                        var HYX = list[i]["优先级"].ToString();