1
zrg
昨天 c4c02944532a9bfda6de9a0cd85a9dfa631ed003
WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/JIT_DayPlanPlatFormBillController.cs
@@ -242,7 +242,7 @@
                        LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
                        if (oSystemParameter.omodel.WMS_CampanyName != "添康科技") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                        if (oSystemParameter.omodel.WMS_CampanyName != "添康科技"&& oSystemParameter.omodel.WMS_CampanyName != "三升") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                        {
                            if (HSourceID == "" || HSourceID == "0")
                            {
@@ -254,7 +254,7 @@
                            }
                        }
                        ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
                            $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
                            $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", "Sc_WorkBillSortBillMain");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
@@ -333,7 +333,7 @@
                        LogService.CustomWriteLog("2.1:"+i, DateTime.Now.ToString("yyyy-MM-dd"));
                        
                        if (oSystemParameter.omodel.WMS_CampanyName != "添康科技") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                        if (oSystemParameter.omodel.WMS_CampanyName != "添康科技" && oSystemParameter.omodel.WMS_CampanyName != "三升") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                        {
                            if (HSourceID == "" || HSourceID == "0")
                            {
@@ -470,13 +470,13 @@
                        else
                        {
                            ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" +
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'') = ''", "Sc_WorkBillSortBillMain");
                            if (ds.Tables[0].Rows.Count > 1)
                            {
                                LogService.CustomWriteLog("第" + i + 1 + "行生产资源有重复,请修改", DateTime.Now.ToString("yyyy-MM-dd"));
                                LogService.CustomWriteLog($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
                                  $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", DateTime.Now.ToString("yyyy-MM-dd"));
                                  $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", DateTime.Now.ToString("yyyy-MM-dd"));
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = $"第{i + 1}行生产资源有重复,请修改!";
@@ -2973,6 +2973,56 @@
        #endregion
        #region ç”Ÿäº§æ—¥è®¡åˆ’平台 è¦æ–™è¿ç®—
        [Route("JIT_DayPlanPlatFormBill/JIT_YLYS")]
        [HttpGet]
        public object JIT_YLYS(string sWhere, string user)
        {
            try
            {
                omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
                string HWorkShopID = omdelMian.HWorkShopID.ToString();
                var HStockOrgID = omdelMian.HProdORGID;
                ds = oCN.RunProcReturn("exec h_p_JIT_WorkDemandPlanBill_MOMaterReady " + HWorkShopID.ToString() + ",'" + user + "'," + HStockOrgID.ToString(), "h_p_JIT_WorkDemandPlanBill_MOMaterReady");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "要料运算发生错误!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);    //运算成功
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "要料运算失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç”Ÿäº§æ—¥è®¡åˆ’平台 é”å®š
        [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedDay")]
        [HttpGet]
@@ -3224,6 +3274,74 @@
        }
        #endregion
        #region ç”Ÿäº§æ—¥è®¡åˆ’平台 æ•°æ®å‡†å¤‡ è®¾ç½®ä»»åŠ¡å•ç›¸å…³ä¿¡æ¯(三升)
        [Route("JIT_DayPlanPlatFormBill/ReadyData_SS")]
        [HttpGet]
        public object ReadyData_SS(string SWhere)
        {
            try
            {
                var list = SWhere.Split(',');
                DataTable dt = new DataTable("date");
                dt.Columns.Add("HICMOInterID", typeof(string));
                dt.Columns.Add("HICMOEntryID", typeof(string));
                dt.Columns.Add("小时产能", typeof(string));
                dt.Columns.Add("生产周期", typeof(decimal));
                dt.Columns.Add("开工余量", typeof(decimal));
                dt.Columns.Add("最迟开工日期", typeof(DateTime));
                dt.Columns.Add("最迟完工日期", typeof(DateTime));
                dt.Columns.Add("订单需求数量", typeof(decimal));
                dt.Columns.Add("订单交货期", typeof(DateTime));
                dt.Columns.Add("HSourceID", typeof(decimal));
                dt.Columns.Add("生产资源", typeof(string));
                for (int i = 0; i < list.Length; i++)
                {
                    string HICMOInterID = list[i].Split(';')[0].ToString();
                    string HICMOEntryID = list[i].Split(';')[1].ToString();
                    string HSourceID = list[i].Split(';')[2].ToString();
                    Thread.Sleep(100);
                    ds = oCN.RunProcReturn("exec h_p_Sc_GetInfoByICMOBillNo " + HICMOInterID + "," + HICMOEntryID + "," + HSourceID, "h_p_Sc_GetInfoByICMOBillNo");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                    }
                    else
                    {
                        DataRow dr = dt.NewRow();
                        dr["HSourceID"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["HSourceID"]);
                        dr["生产资源"] = ds.Tables[0].Rows[0]["生产资源"].ToString();
                        dr["小时产能"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["产能"]);
                        dr["生产周期"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["生产周期"]);
                        dr["开工余量"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["开工余量"]);
                        dr["最迟开工日期"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["最迟开工日期"]);
                        dr["最迟完工日期"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["最迟完工日期"]);
                        dr["订单需求数量"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["订单需求数"]);
                        dr["订单交货期"] = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["订单交货期"]);
                        dr["HICMOInterID"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["HICMOInterID"]);
                        dr["HICMOEntryID"] = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["HICMOEntryID"]);
                        dt.Rows.Add(dr);
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = dt;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  ç¼ºæ–™åˆ†æžæŠ¥è¡¨
        public class MaterialShorAnalysis
        {