Пример #1
0
 public TargetOutPut GET_TARGET_OUTPUT(string FACTORY_CD, string LINE_CODE, string PLAN_DATE)
 {
     try
     {
         string query;
         query = string.Format(@"
                     select isnull(convert(int,sum(A.PLAN_QTY)),0)  as Total_Product_Qty from FR_JO_DAILY_PLAN_DATA A LEFT join CP_FR_PRODUCT_LINE_MAPPING B
                      on A.SEWING_LINE=B.FR_SEWING_LINE_CD 
                      WHERE isnull(b.MES_PRODUCT_LINE_CD,a.SEWING_LINE)='{0}' and A.PLAN_DATE='{1}' AND A.FACTORY='{2}'
                    ", LINE_CODE, PLAN_DATE, FACTORY_CD);
         // return db.Database.SqlQuery<TargetOutPut>(query).Single();
         TargetOutPut kk = null;
         kk = db.Database.SqlQuery <TargetOutPut>(query).Single();
         return(kk);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
     }
 }
Пример #2
0
        public RUNNING_BASIC_INFORMATION GET_RUNNING_BASIC_INFORMATION(string FACTORY_CD, String LINE_CODE, string SHIFT_CODE, DateTime?TRX_DATE, BASICINFORMATION_DATA BASICINFORMATION_data)
        {
            try
            {
                //获取需要的信息1:来自于本机文件设置
                RUNNING_BASIC_INFORMATION RUNNING_BASIC_INFORMATION_data = new RUNNING_BASIC_INFORMATION();
                RUNNING_BASIC_INFORMATION_data.FACTORY_CD       = BASICINFORMATION_data.FACTORY_CD;
                RUNNING_BASIC_INFORMATION_data.GARMENT_TYPE     = BASICINFORMATION_data.GARMENT_TYPE;
                RUNNING_BASIC_INFORMATION_data.REFRESH_INTERVAL = BASICINFORMATION_data.REFRESH_INTERVAL;
                //获取需要的信息2:自动判断的信息,日期和班次(date,shift)
                // SHIFT_CODE_BY_TIME SHIFT_CODE_BY_TIME = dashboarddal.SHIFT_CODE_BY_TIME(BASICINFORMATION_data.FACTORY_CD, null, null); //remark by sunny 20180312
                SHIFT_CODE_BY_TIME SHIFT_CODE_BY_TIME = dashboarddal.SHIFT_CODE_BY_LINE_AND_TIME(BASICINFORMATION_data.FACTORY_CD, LINE_CODE, BASICINFORMATION_data.SHIFT_CODE1, BASICINFORMATION_data.SHIFT_CODE2, null); //add by sunny 20180312

                RUNNING_BASIC_INFORMATION_data.LANGUAGE = BASICINFORMATION_data.LANGUAGE;
                RUNNING_BASIC_INFORMATION_data.TRX_DATE = SHIFT_CODE_BY_TIME.TRX_DATE;
                //tangyh 2018.05.14
                //if (string.IsNullOrEmpty(SHIFT_CODE) || string.IsNullOrWhiteSpace(SHIFT_CODE))
                // SHIFT_CODE = SHIFT_CODE_BY_TIME.SHIFT_CODE;
                //tangyh 3018.05.19
                if ((SHIFT_CODE == SHIFT_CODE_BY_TIME.SHIFT_CODE) || (SHIFT_CODE == null))
                {
                    RUNNING_BASIC_INFORMATION_data.CHANGESHIFT = "N";
                }
                else
                {
                    RUNNING_BASIC_INFORMATION_data.CHANGESHIFT = "Y";
                }

                RUNNING_BASIC_INFORMATION_data.SHIFT_CODE = SHIFT_CODE_BY_TIME.SHIFT_CODE;

                //获取需要的信息3:根据自动判断的班次信息和本机设置的信息判断应该显示的组别

                /*if (SHIFT_CODE == BASICINFORMATION_data.SHIFT_CODE1)
                 * {
                 *  RUNNING_BASIC_INFORMATION_data.LINE_CODE = BASICINFORMATION_data.LINE_CODE1;
                 * }
                 * else if (SHIFT_CODE == BASICINFORMATION_data.SHIFT_CODE2)
                 * {
                 *  RUNNING_BASIC_INFORMATION_data.LINE_CODE = BASICINFORMATION_data.LINE_CODE2;
                 * }*/                                                // remark by sunny 20180312

                RUNNING_BASIC_INFORMATION_data.LINE_CODE = LINE_CODE; //add by sunny 20180312

                if ((string.IsNullOrEmpty(BASICINFORMATION_data.SHIFT_CODE3) == false) && (string.IsNullOrEmpty(BASICINFORMATION_data.LINE_CODE3) == false))
                {
                    RUNNING_BASIC_INFORMATION_data.SHIFT_CODE = BASICINFORMATION_data.SHIFT_CODE3;
                    RUNNING_BASIC_INFORMATION_data.LINE_CODE  = BASICINFORMATION_data.LINE_CODE3;
                    RUNNING_BASIC_INFORMATION_data.TRX_DATE   = BASICINFORMATION_data.SHOWED_DATE3;
                }

                /*if ((string.IsNullOrEmpty(BASICINFORMATION_data.LINE_CODE1) == false) || (string.IsNullOrEmpty(BASICINFORMATION_data.LINE_CODE2) == false))
                 * {
                 *  RUNNING_BASIC_INFORMATION_data.Only1Line = "Y";
                 *  if (string.IsNullOrEmpty(BASICINFORMATION_data.LINE_CODE1) == false)
                 *  {
                 *      RUNNING_BASIC_INFORMATION_data.LINE_CODE = BASICINFORMATION_data.LINE_CODE1;
                 *  }
                 *  else
                 *  {
                 *      RUNNING_BASIC_INFORMATION_data.LINE_CODE = BASICINFORMATION_data.LINE_CODE2;
                 *  }
                 *
                 * }
                 * else
                 * {
                 *  RUNNING_BASIC_INFORMATION_data.Only1Line = "N";
                 * }*/                                          // remark by sunny 20180312

                RUNNING_BASIC_INFORMATION_data.Only1Line = "Y"; // add by sunny 20180312 support only one Line .

                RUNNING_BASIC_INFORMATION_data.HR_MAX_TIME_DIFFERENCE = BASICINFORMATION_data.HR_MAX_TIME_DIFFERENCE;
                RUNNING_BASIC_INFORMATION_data.HR_REFRESH_INTERVAL    = BASICINFORMATION_data.HR_REFRESH_INTERVAL;
                RUNNING_BASIC_INFORMATION_data.TARGET_TOTAL_QTY       = BASICINFORMATION_data.TARGET_TOTAL_QTY;

                //revise  target total qty with new logic by sunny 20180312 start
                TargetOutPut targetOutput = dashboarddal.GET_TARGET_OUTPUT(BASICINFORMATION_data.FACTORY_CD, RUNNING_BASIC_INFORMATION_data.LINE_CODE, RUNNING_BASIC_INFORMATION_data.TRX_DATE.ToString("yyyy-MM-dd")); //add by sunny 20180312
                if (targetOutput.Total_Product_Qty != null)
                {
                    RUNNING_BASIC_INFORMATION_data.TARGET_TOTAL_QTY = targetOutput.Total_Product_Qty + BASICINFORMATION_data.TARGET_TOTAL_QTY;
                    if (BASICINFORMATION_data.SHIFT_CODE1.Trim() != "" && BASICINFORMATION_data.SHIFT_CODE2.Trim() != "")
                    {
                        RUNNING_BASIC_INFORMATION_data.TARGET_TOTAL_QTY = int.Parse(Math.Round((Double)(RUNNING_BASIC_INFORMATION_data.TARGET_TOTAL_QTY / 2), 0, MidpointRounding.AwayFromZero).ToString());
                    }
                }
                //revise  target total qty with new logic by sunny 20180312 end


                RUNNING_BASIC_INFORMATION_data.TARGET_WORK_HOUR       = BASICINFORMATION_data.TARGET_WORK_HOUR;
                RUNNING_BASIC_INFORMATION_data.DISPLAY_TARGET2_DEFECT = BASICINFORMATION_data.DISPLAY_TARGET2_DEFECT;
                RUNNING_BASIC_INFORMATION_data.USE_LINE_TARGET2       = BASICINFORMATION_data.USE_LINE_TARGET2;
                return(RUNNING_BASIC_INFORMATION_data);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
            }
        }