yangle
2023-02-08 1d47cda889c0408d2fe885fc99727e85c591764c
WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/JIT_DayPlanPlatFormBillController.cs
@@ -1217,30 +1217,67 @@
        #region ç”Ÿäº§æ—¥è®¡åˆ’平台 ç”Ÿäº§è®¢å•查询
        [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
        [HttpGet]
        public object JIT_ICMOBillList(string hmainid, string HEntryID)
        public object JIT_ICMOBillList(string hmainid)
        {
            try
            {
                DataSet dt = new DataSet();
                ds = oCN.RunProcReturn($"exec h_p_ICMOBillList_PrimarySubTable '{hmainid}','{HEntryID}'", "h_p_ICMOBillList_PrimarySubTable");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                var list = hmainid.Split(',');
                List<DataTable> listdt = new List<DataTable>();
                DataTable dtable = new DataTable("dt");
                for (int i = 0; i < list.Length; i++)
                {
                    dt = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where æºå•主内码 in({ds.Tables[0].Rows[i]["源单主内码"].ToString()}) and  æºå•子内码 in({ds.Tables[0].Rows[i]["源单子内码"].ToString()})", "h_v_JIT_Sc_WorkBillSortBillList");
                    var listEvery = list[i].Split('_');
                    ds = oCN.RunProcReturn($"exec h_p_ICMOBillList_PrimarySubTable '{listEvery[0]}','{listEvery[1]}'", "h_p_ICMOBillList_PrimarySubTable");
                    var dt = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where æºå•主内码 in({ds.Tables[0].Rows[0]["源单主内码"].ToString()}) and  æºå•子内码 in({ds.Tables[0].Rows[0]["源单子内码"].ToString()})", "h_v_JIT_Sc_WorkBillSortBillList");
                    if (dt.Tables[0].Rows.Count > 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "生产明细行重复,重复的生产订单号:"+ ds.Tables[0].Rows[i]["生产订单号"].ToString()+",明细行号:"+ ds.Tables[0].Rows[i]["生产订单明细行号"].ToString();
                        objJsonResult.Message = "生产明细行重复,重复的生产订单号:" + ds.Tables[0].Rows[i]["生产订单号"].ToString() + ",明细行号:" + ds.Tables[0].Rows[i]["生产订单明细行号"].ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (i == 0)
                    {
                        //添加列名
                        for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                        {
                            dtable.Columns.Add(ds.Tables[0].Columns[j].ToString());
                        }
                    }
                    listdt.Add(ds.Tables[0]);
                }
                //获取集合数据
                for (int i = 0; i < listdt.Count; i++)
                {
                    DataRow row = dtable.NewRow();
                    for (int j = 0; j < listdt[i].Columns.Count; j++)
                    {
                        if (listdt[i].Columns[j].ColumnName == "计划数量")
                        {
                            row[j] = double.Parse(listdt[i].Rows[0][j].ToString()).ToString();
                        }
                        else
                        {
                            row[j] = listdt[i].Rows[0][j].ToString();
                        }
                    }
                    dtable.Rows.Add(row);
                }
                //添加动态日期
                for (int j = 1; j <= 31; j++)
                {
                    dtable.Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.data = dtable;
                return objJsonResult;
            }
            catch (Exception e)