Exemplo n.º 1
0
 public virtual void CreateDssImportHistory(DssInboundControl dssInboundControl, IList<DssImportHistory> dssImportHistoryList, string[] files)
 {
     #region Create DssImportHistory
     try
     {
         dssImportHistoryMgr.CreateDssImportHistory(dssImportHistoryList);
     }
     catch (Exception ex)
     {
         logLoadFile.Error("Write to database error:", ex);
         throw new BusinessErrorException("Write to database error.", ex);
     }
     #endregion
 }
Exemplo n.º 2
0
 public virtual void CreateDssImportHistory(DssInboundControl dssInboundControl, IList <DssImportHistory> dssImportHistoryList, string[] files)
 {
     #region Create DssImportHistory
     try
     {
         dssImportHistoryMgr.CreateDssImportHistory(dssImportHistoryList);
     }
     catch (Exception ex)
     {
         logLoadFile.Error("Write to database error:", ex);
         throw new BusinessErrorException("Write to database error.", ex);
     }
     #endregion
 }
Exemplo n.º 3
0
        public virtual void ProcessInboundRecord(DssInboundControl dssInboundControl)
        {
            #region 执行导入程序
            if (dssInboundControl.Id != 9)  //工单导入不通过程序执行,改为在存储过程中执行
            {
                log.Debug("Start process record for " + dssInboundControl.ServiceName);
                IList <DssImportHistory> activeDssImportHistoryList = dssImportHistoryMgr.GetActiveDssImportHistory(dssInboundControl.Id);
                if (activeDssImportHistoryList != null && activeDssImportHistoryList.Count > 0)
                {
                    log.Debug("total " + activeDssImportHistoryList.Count + " records.");
                    foreach (DssImportHistory activeDssImportHistory in activeDssImportHistoryList)
                    {
                        log.Debug("Start process record " + activeDssImportHistory.Id);
                        try
                        {
                            if (activeDssImportHistory.EventCode == BusinessConstants.DSS_EVENT_CODE_CREATE)
                            {
                                this.CreateOrUpdateObject(this.DeserializeForCreate(activeDssImportHistory));
                            }
                            else if (activeDssImportHistory.EventCode == BusinessConstants.DSS_EVENT_CODE_DELETE)
                            {
                                this.DeleteObject(this.DeserializeForDelete(activeDssImportHistory));
                            }

                            this.genericMgr.ExecuteSql("update DssImpHis set IsActive = 0 where Id = " + activeDssImportHistory.Id);
                            //activeDssImportHistory.IsActive = false;
                            //activeDssImportHistory.LastModifyDate = DateTime.Now;
                            //activeDssImportHistory.LastModifyUser = "******";
                            //this.dssImportHistoryMgr.Update(activeDssImportHistory);
                            //this.dssImportHistoryMgr.FlushSession();
                        }
                        catch (Exception ex)
                        {
                            this.dssImportHistoryMgr.CleanSession();
                            this.genericMgr.ExecuteSql("update DssImpHis set ErrCount = ISNULL(ErrCount, 0) + 1 where Id = " + activeDssImportHistory.Id);
                            //activeDssImportHistory.ErrorCount++;
                            //activeDssImportHistory.LastModifyDate = DateTime.Now;
                            //activeDssImportHistory.LastModifyUser = "******";
                            //this.dssImportHistoryMgr.Update(activeDssImportHistory);
                            logLoadFile.Error("Write to database error:", ex);
                        }
                        log.Debug("End process record " + activeDssImportHistory.Id);
                    }
                }

                log.Debug("End process record for " + dssInboundControl.ServiceName);
            }
            #endregion
        }
Exemplo n.º 4
0
        public void ProcessDssInboundRecord(DssInboundControl dssInboundControl)
        {
            lock (ProcessDssInboundRecordLock)
            {
                IList <DssImportHistory> activeDssImportHistoryList = dssImportHistoryMgr.GetActiveDssImportHistory(dssInboundControl.Id);

                IList <object> objCreate = this.ProcessCreateData(activeDssImportHistoryList);
                IList <object> objDelete = this.ProcessDeleteData(activeDssImportHistoryList);

                try
                {
                    this.CreateOrUpdateObject(objCreate);
                    this.DeleteObject(objDelete);
                }
                catch (Exception ex)
                {
                    logLoadFile.Error("Write to database error:", ex);
                }
            }
        }
Exemplo n.º 5
0
        public void DoAsyncProcessDssInboundRecord(DssInboundControl dssInboundControl)
        {
            AsyncProcessDssInboundRecord asyncProcessDssInboundRecord = new AsyncProcessDssInboundRecord(this.ProcessDssInboundRecord);

            asyncProcessDssInboundRecord.BeginInvoke(dssInboundControl, null, null);
        }
Exemplo n.º 6
0
        public virtual void ProcessInboundFile(DssInboundControl dssInboundControl, string[] files)
        {
            logLoadFile.Info("Start process inbound ");

            //重新提交数据
            #region DataReader
            foreach (string fileName in files)
            {
                try
                {
                    IList <DssImportHistory> dssImportHistoryList = new List <DssImportHistory>();

                    #region 读取文件
                    logLoadFile.Info("Start load file " + fileName);
                    FlatFileReader reader = null;
                    try
                    {
                        DssImportHistory dssImportHistory = new DssImportHistory();
                        dssImportHistory.DssInboundCtrl = dssInboundControl;
                        dssImportHistory.IsActive       = true;
                        dssImportHistory.KeyCode        = Path.GetFileNameWithoutExtension(fileName);
                        dssImportHistory.CreateDate     = DateTime.Now;

                        reader = this.DataReader(fileName, Encoding.GetEncoding(dssInboundControl.FileEncoding), "|");
                        for (string[] lineData = reader.ReadLine(); lineData != null; lineData = reader.ReadLine())
                        {
                            this.FillDssImportHistory(lineData, dssImportHistory);

                            if (dssImportHistory[0] == "0")
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_DELETE;
                                DssHelper.FormatDeleteData(lineData, BusinessConstants.DSS_SYSTEM_CODE_QAD);//QAD删除去引号
                            }
                            else
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_CREATE;
                            }
                        }

                        dssImportHistoryList.Add(dssImportHistory);
                    }
                    catch (Exception ex)
                    {
                        reader.Dispose();
                        logLoadFile.Error("Process inbound file: " + fileName + " Error.", ex);
                        throw ex;
                    }
                    finally
                    {
                        reader.Dispose();
                        logLoadFile.Info("Process inbound file: " + fileName + " successful.");
                    }
                    logLoadFile.Info("End load file " + fileName);
                    #endregion

                    #region CreateDssImportHistory
                    logLoadFile.Info("Start save file" + fileName);
                    CreateDssImportHistory(dssInboundControl, dssImportHistoryList, files);
                    logLoadFile.Info("End save file" + fileName);
                    #endregion

                    #region Archive download file
                    try
                    {
                        logLoadFile.Info("Start backup file " + fileName);
                        ArchiveFile(new string[] { fileName }, dssInboundControl.ArchiveFloder);
                        logLoadFile.Info("End backup file" + fileName);
                    }
                    catch (Exception ex)
                    {
                        logLoadFile.Error("Archive download file error:", ex);
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    logLoadFile.Error("Create DssImportHistory error:", ex);
                }
            }
            #endregion
        }
Exemplo n.º 7
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        try
        {
            HSSFWorkbook excel = new HSSFWorkbook(fileUpload.PostedFile.InputStream);
            Sheet        sheet = excel.GetSheetAt(0);
            IEnumerator  rows  = sheet.GetRowEnumerator();
            ImportHelper.JumpRows(rows, 10);
            //生产线	物料号	物料描述	条码	数量	上线日期	上线时间	生产单号


            #region 列定义
            int colProdLine       = 1; //供货路线
            int colItemCode       = 2; //物料号
            int colHuId           = 4; // 条码号
            int colQty            = 5; //订单数
            int colOfflineDateStr = 6; //上线日期
            int colOfflineTimeStr = 7; //上线时间
            int colOrderNo        = 8; //生产单号
            #endregion
            int rowCount = 10;
            //IList<Exception> exceptionList = new List<Exception>();
            //Exception exceptio = new Exception();
            string                   errorMessage = string.Empty;
            DateTime                 nowTime      = DateTime.Now;
            DssInboundControl        control      = TheGenericMgr.FindById <DssInboundControl>(9);
            IList <DssImportHistory> importList   = new List <DssImportHistory>();
            while (rows.MoveNext())
            {
                rowCount++;
                HSSFRow row = (HSSFRow)rows.Current;
                if (!TheImportMgr.CheckValidDataRow(row, 1, 4))
                {
                    break;//边界
                }
                string  prodLineCode   = string.Empty;
                Item    Item           = null;
                string  huId           = string.Empty;
                decimal qty            = 0;
                string  offlineDateStr = string.Empty;
                string  offlineTimeStr = string.Empty;
                string  orderNo        = string.Empty;

                #region 读取数据
                #region 生产线
                prodLineCode = row.GetCell(colProdLine) != null?row.GetCell(colProdLine).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(prodLineCode))
                {
                    //ShowErrorMessage(string.Format("第{0}行:供货路线不能为空。", rowCount));
                    errorMessage += string.Format("第{0}行:生产线不能为空。<br/>", rowCount);
                    continue;
                }
                #endregion

                #region 读取物料代码
                string itemCode = row.GetCell(colItemCode) != null?row.GetCell(colItemCode).StringCellValue : string.Empty;

                if (itemCode == null || itemCode.Trim() == string.Empty)
                {
                    errorMessage += string.Format("第{0}行:物料代码不能为空。<br/>", rowCount);
                    //ShowErrorMessage(string.Format("第{0}行:物料代码不能为空。", rowCount));
                    continue;
                }
                else
                {
                    Item = this.TheGenericMgr.FindById <Item>(itemCode);
                    if (Item == null)
                    {
                        errorMessage += string.Format("第{0}行:物料代码{1}不存在。<br/>", rowCount, itemCode);
                        continue;
                    }
                }

                #endregion

                #region 条码
                huId = row.GetCell(colHuId) != null?row.GetCell(colHuId).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(huId))
                {
                    errorMessage += string.Format("第{0}行:条码不能为空。<br/>", rowCount);
                    continue;
                }
                else
                {
                    if (huId.Length < 9)
                    {
                        errorMessage += string.Format("第{0}行:条码长度不能小于9。<br/>", rowCount);
                        continue;
                    }
                    var yearCodeArr  = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "S", "T", "V", "W", "X", "Y" };
                    var monthCodeArr = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C" };
                    var yearCode     = huId.Substring(huId.Length - 8, 1);
                    if (yearCodeArr.Where(a => a == yearCode).Count() == 0)
                    {
                        errorMessage += string.Format("第{0}行:批号的年份格式不正确。。<br/>", rowCount);
                        continue;
                    }

                    var monthCode = huId.Substring(huId.Length - 7, 1);
                    if (monthCodeArr.Where(a => a == monthCode).Count() == 0)
                    {
                        errorMessage += string.Format("第{0}行:批号的月份格式不正确。。。<br/>", rowCount);
                        continue;
                    }

                    var dayCode = int.Parse(huId.Substring(huId.Length - 6, 2));
                    if (dayCode < 1 || dayCode > 31)
                    {
                        errorMessage += string.Format("第{0}行:批号的日期格式不正确。<br/>", rowCount);
                        continue;
                    }
                }
                #endregion

                #region 读取数量
                try
                {
                    qty = Convert.ToDecimal(row.GetCell(colQty).NumericCellValue);
                }
                catch
                {
                    errorMessage += string.Format("第{0}行:数量填写有误。<br/>", rowCount);
                    continue;
                }
                #endregion

                #region  线日期
                offlineDateStr = row.GetCell(colOfflineDateStr) != null?row.GetCell(colOfflineDateStr).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(offlineDateStr))
                {
                    errorMessage += string.Format("第{0}行:上线日期不能为空。<br/>", rowCount);
                    continue;
                }
                #endregion

                #region  线时间
                offlineTimeStr = row.GetCell(colOfflineTimeStr) != null?row.GetCell(colOfflineTimeStr).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(offlineTimeStr))
                {
                    errorMessage += string.Format("第{0}行:上线时间不能为空。<br/>", rowCount);
                    continue;
                }
                else
                {
                    try
                    {
                        var offlineDateTime = DateTime.Parse(offlineDateStr + " " + offlineTimeStr);
                    }
                    catch (Exception ex)
                    {
                        errorMessage += string.Format("第{0}行:[上线日期{1}+上线时间{2}]不符合要求。<br/>", rowCount, offlineDateStr, offlineTimeStr);
                        continue;
                    }
                }
                #endregion



                #region 生产线
                orderNo = row.GetCell(colOrderNo) != null?row.GetCell(colOrderNo).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(orderNo))
                {
                    errorMessage += string.Format("第{0}行:生产单号不能为空。<br/>", rowCount);
                    continue;
                }
                #endregion
                #endregion

                #region 填充数据
                DssImportHistory dssImportHistory = new DssImportHistory {
                    data0          = prodLineCode,
                    data1          = Item.Code,
                    data2          = huId,
                    data3          = qty.ToString(),
                    data7          = offlineDateStr,
                    data8          = offlineTimeStr,
                    data12         = orderNo,
                    IsActive       = true,
                    ErrorCount     = 0,
                    CreateDate     = nowTime,
                    LastModifyDate = nowTime,
                    LastModifyUser = CurrentUser.Code,
                    DssInboundCtrl = control,
                    EventCode      = "CREATE",
                    KeyCode        = "EXCEL",
                };
                importList.Add(dssImportHistory);

                #endregion
            }
            if (!string.IsNullOrEmpty(errorMessage))
            {
                throw new Exception(errorMessage);
            }
            if (importList.Count == 0)
            {
                throw new Exception("导入的有效数据为0.");
            }

            //try
            //{
            //    foreach (var dssImpHis in importList)
            //    {
            //        TheGenericMgr.Create(dssImpHis);
            //    }
            //}
            //catch (Exception ex)
            //{

            //    throw ex;
            //}


            TheMaterialFlushBackMgr.ImportProdItemHuId(importList);

            ShowSuccessMessage("导入成功。");
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
        catch (Exception ex)
        {
            ShowErrorMessage(ex.Message);
            return;
        }
    }
 public virtual void UpdateDssInboundControl(DssInboundControl entity)
 {
     Update(entity);
 }
Exemplo n.º 9
0
        public void ProcessDssInboundRecord(DssInboundControl dssInboundControl)
        {
            lock (ProcessDssInboundRecordLock)
            {
                IList<DssImportHistory> activeDssImportHistoryList = dssImportHistoryMgr.GetActiveDssImportHistory(dssInboundControl.Id);

                IList<object> objCreate = this.ProcessCreateData(activeDssImportHistoryList);
                IList<object> objDelete = this.ProcessDeleteData(activeDssImportHistoryList);

                try
                {
                    this.CreateOrUpdateObject(objCreate);
                    this.DeleteObject(objDelete);
                }
                catch (Exception ex)
                {
                    logLoadFile.Error("Write to database error:", ex);
                }
            }
        }
Exemplo n.º 10
0
 public void DoAsyncProcessDssInboundRecord(DssInboundControl dssInboundControl)
 {
     AsyncProcessDssInboundRecord asyncProcessDssInboundRecord = new AsyncProcessDssInboundRecord(this.ProcessDssInboundRecord);
     asyncProcessDssInboundRecord.BeginInvoke(dssInboundControl, null, null);
 }
Exemplo n.º 11
0
 public virtual void DeleteDssInboundControl(DssInboundControl entity)
 {
     Delete(entity);
 }
Exemplo n.º 12
0
 public virtual void UpdateDssInboundControl(DssInboundControl entity)
 {
     Update(entity);
 }
Exemplo n.º 13
0
 public virtual void CreateDssInboundControl(DssInboundControl entity)
 {
     Create(entity);
 }
        public virtual void ProcessInboundFile(DssInboundControl dssInboundControl, string[] files)
        {
            log.Info("Start process inbound ");

            //重新提交数据
            IList<DssImportHistory> activeDssImportHistoryList = dssImportHistoryMgrE.GetActiveDssImportHistory(dssInboundControl.Id);

            #region DataReader
            IList<DssImportHistory> dssImportHistoryList = new List<DssImportHistory>();
            foreach (string fileName in files)
            {
                try
                {
                    FlatFileReader reader = null;
                    try
                    {
                        DssImportHistory dssImportHistory = new DssImportHistory();
                        dssImportHistory.DssInboundCtrl = dssInboundControl;
                        dssImportHistory.IsActive = true;
                        dssImportHistory.KeyCode = Path.GetFileNameWithoutExtension(fileName);
                        dssImportHistory.CreateDate = DateTime.Now;

                        reader = this.DataReader(fileName, Encoding.GetEncoding(dssInboundControl.FileEncoding), "|");
                        for (string[] lineData = reader.ReadLine(); lineData != null; lineData = reader.ReadLine())
                        {
                            this.FillDssImportHistory(lineData, dssImportHistory);

                            if (dssImportHistory[0] == "0")
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_DELETE;
                                DssHelper.FormatDeleteData(lineData, BusinessConstants.DSS_SYSTEM_CODE_QAD);//QAD删除去引号
                            }
                            else
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_CREATE;
                            }
                        }

                        dssImportHistoryList.Add(dssImportHistory);
                    }
                    catch (Exception ex)
                    {
                        reader.Dispose();
                        log.Error("Process inbound file: " + fileName + " Error.", ex);
                        throw ex;
                    }
                    finally
                    {
                        reader.Dispose();
                        log.Info("Process inbound file: " + fileName + " successful.");
                    }
                }
                catch (Exception ex)
                {

                    log.Error("Create DssImportHistory error:", ex);
                }
            }
            #endregion

            #region CreateDssImportHistory
            CreateDssImportHistory(dssInboundControl, dssImportHistoryList, files);
            #endregion

            #region Archive download file
            try
            {
                ArchiveFile(files, dssInboundControl.ArchiveFloder);
            }
            catch (Exception ex)
            {
                log.Error("Archive download file error:", ex);
            }
            #endregion

            IListHelper.AddRange<DssImportHistory>(activeDssImportHistoryList, dssImportHistoryList);

            IList<object> objCreate = this.ProcessCreateData(activeDssImportHistoryList);
            IList<object> objDelete = this.ProcessDeleteData(activeDssImportHistoryList);

            try
            {
                this.CreateOrUpdateObject(objCreate);
                this.DeleteObject(objDelete);

                //山寨,先把除工单的全部更新active为false,以免每次都随工单执行
                if(dssInboundControl.Id != 9)
                {
                    foreach(DssImportHistory dssImpHis in activeDssImportHistoryList)
                    {
                        dssImpHis.IsActive = false;
                        dssImportHistoryMgrE.UpdateDssImportHistory(dssImpHis);
                    }
                
                }
            }
            catch (Exception ex)
            {
                log.Error("Write to database error:", ex);
            }
        }
Exemplo n.º 15
0
        public virtual void ProcessInboundFile(DssInboundControl dssInboundControl, string[] files)
        {
            logLoadFile.Info("Start process inbound ");

            //重新提交数据
            #region DataReader
            foreach (string fileName in files)
            {
                try
                {
                    IList<DssImportHistory> dssImportHistoryList = new List<DssImportHistory>();

                    #region 读取文件
                    logLoadFile.Info("Start load file " + fileName);
                    FlatFileReader reader = null;
                    try
                    {
                        DssImportHistory dssImportHistory = new DssImportHistory();
                        dssImportHistory.DssInboundCtrl = dssInboundControl;
                        dssImportHistory.IsActive = true;
                        dssImportHistory.KeyCode = Path.GetFileNameWithoutExtension(fileName);
                        dssImportHistory.CreateDate = DateTime.Now;

                        reader = this.DataReader(fileName, Encoding.GetEncoding(dssInboundControl.FileEncoding), "|");
                        for (string[] lineData = reader.ReadLine(); lineData != null; lineData = reader.ReadLine())
                        {
                            this.FillDssImportHistory(lineData, dssImportHistory);

                            if (dssImportHistory[0] == "0")
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_DELETE;
                                DssHelper.FormatDeleteData(lineData, BusinessConstants.DSS_SYSTEM_CODE_QAD);//QAD删除去引号
                            }
                            else
                            {
                                dssImportHistory.EventCode = BusinessConstants.DSS_EVENT_CODE_CREATE;
                            }
                        }

                        dssImportHistoryList.Add(dssImportHistory);
                    }
                    catch (Exception ex)
                    {
                        reader.Dispose();
                        logLoadFile.Error("Process inbound file: " + fileName + " Error.", ex);
                        throw ex;
                    }
                    finally
                    {
                        reader.Dispose();
                        logLoadFile.Info("Process inbound file: " + fileName + " successful.");
                    }
                    logLoadFile.Info("End load file " + fileName);
                    #endregion

                    #region CreateDssImportHistory
                    logLoadFile.Info("Start save file" + fileName);
                    CreateDssImportHistory(dssInboundControl, dssImportHistoryList, files);
                    logLoadFile.Info("End save file" + fileName);
                    #endregion

                    #region Archive download file
                    try
                    {
                        logLoadFile.Info("Start backup file " + fileName);
                        ArchiveFile(new string[] { fileName }, dssInboundControl.ArchiveFloder);
                        logLoadFile.Info("End backup file" + fileName);
                    }
                    catch (Exception ex)
                    {
                        logLoadFile.Error("Archive download file error:", ex);
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    logLoadFile.Error("Create DssImportHistory error:", ex);
                }
            }
            #endregion
        }
 public virtual void CreateDssInboundControl(DssInboundControl entity)
 {
     Create(entity);
 }
Exemplo n.º 17
0
        public virtual void ProcessInboundRecord(DssInboundControl dssInboundControl)
        {
            #region 执行导入程序
            if (dssInboundControl.Id != 9)  //工单导入不通过程序执行,改为在存储过程中执行
            {
                log.Debug("Start process record for " + dssInboundControl.ServiceName);
                IList<DssImportHistory> activeDssImportHistoryList = dssImportHistoryMgr.GetActiveDssImportHistory(dssInboundControl.Id);
                if (activeDssImportHistoryList != null && activeDssImportHistoryList.Count > 0)
                {
                    log.Debug("total " + activeDssImportHistoryList.Count + " records.");
                    foreach (DssImportHistory activeDssImportHistory in activeDssImportHistoryList)
                    {
                        log.Debug("Start process record " + activeDssImportHistory.Id);
                        try
                        {
                            if (activeDssImportHistory.EventCode == BusinessConstants.DSS_EVENT_CODE_CREATE)
                            {
                                this.CreateOrUpdateObject(this.DeserializeForCreate(activeDssImportHistory));
                            }
                            else if (activeDssImportHistory.EventCode == BusinessConstants.DSS_EVENT_CODE_DELETE)
                            {
                                this.DeleteObject(this.DeserializeForDelete(activeDssImportHistory));
                            }

                            this.genericMgr.ExecuteSql("update DssImpHis set IsActive = 0 where Id = " + activeDssImportHistory.Id);
                            //activeDssImportHistory.IsActive = false;
                            //activeDssImportHistory.LastModifyDate = DateTime.Now;
                            //activeDssImportHistory.LastModifyUser = "******";
                            //this.dssImportHistoryMgr.Update(activeDssImportHistory);
                            //this.dssImportHistoryMgr.FlushSession();
                        }
                        catch (Exception ex)
                        {
                            this.dssImportHistoryMgr.CleanSession();
                            this.genericMgr.ExecuteSql("update DssImpHis set ErrCount = ISNULL(ErrCount, 0) + 1 where Id = " + activeDssImportHistory.Id);
                            //activeDssImportHistory.ErrorCount++;
                            //activeDssImportHistory.LastModifyDate = DateTime.Now;
                            //activeDssImportHistory.LastModifyUser = "******";
                            //this.dssImportHistoryMgr.Update(activeDssImportHistory);
                            logLoadFile.Error("Write to database error:", ex);
                        }
                        log.Debug("End process record " + activeDssImportHistory.Id);
                    }
                }

                log.Debug("End process record for " + dssInboundControl.ServiceName);
            }
            #endregion
        }
 public virtual void DeleteDssInboundControl(DssInboundControl entity)
 {
     Delete(entity);
 }
Exemplo n.º 19
0
        private void ProcessOrderIn(MesScmsTableIndex mesScmsTableIndex)
        {
            if (mesScmsTableIndex.TableName == MesDssConstants.MES_SCMS_TABLEINDEX_TABLE_NAME_MES_SCMS_COMPLETED_ORDER)
            {
                IList <MesScmsCompletedOrder> orderList = mesScmsCompletedOrderMgr.GetUpdateMesScmsCompletedOrder();
                if (orderList != null && orderList.Count > 0)
                {
                    foreach (MesScmsCompletedOrder mesScmsCompletedOrder in orderList)
                    {
                        try
                        {
                            if (mesScmsCompletedBoxMgr.GetMesScmsCompletedBox(mesScmsCompletedOrder.OrderNo) > 0)
                            {
                                continue;
                            }
                            orderMgr.ManualCompleteOrder(mesScmsCompletedOrder.OrderNo, userMgr.GetMonitorUser());
                            mesScmsCompletedOrderMgr.Complete(mesScmsCompletedOrder);
                        }
                        catch (Exception e)
                        {
                            this.CleanSession();
                            log.Error(mesScmsCompletedOrder.OrderNo + " complete exception", e);
                            continue;
                        }
                    }
                }
            }
            else if (mesScmsTableIndex.TableName == MesDssConstants.MES_SCMS_TABLEINDEX_TABLE_NAME_MES_SCMS_COMPLETED_BOX)
            {
                IList <MesScmsCompletedBox> huList = mesScmsCompletedBoxMgr.GetUpdateMesScmsCompletedBox();
                if (huList != null && huList.Count > 0)
                {
                    DateTime          dateTimeNow       = DateTime.Now;
                    DssInboundControl dssInboundControl = dssInboundControlMgr.LoadDssInboundControl(9);
                    foreach (MesScmsCompletedBox mesScmsCompletedBox in huList)
                    {
                        try
                        {
                            DssImportHistory dssImportHistory = new DssImportHistory();
                            dssImportHistory.DssInboundCtrl = dssInboundControl;
                            dssImportHistory.EventCode      = "CREATE";
                            dssImportHistory.IsActive       = true;
                            dssImportHistory.KeyCode        = "MES";
                            dssImportHistory.ItemCode       = mesScmsCompletedBox.ItemCode;
                            dssImportHistory.HuId           = mesScmsCompletedBox.HuId;
                            dssImportHistory.Qty            = (decimal)mesScmsCompletedBox.Qty;
                            dssImportHistory.CreateDate     = DateTime.Now;
                            dssImportHistory.data1          = mesScmsCompletedBox.ItemCode;
                            dssImportHistory.data2          = mesScmsCompletedBox.HuId;
                            dssImportHistory.data3          = mesScmsCompletedBox.Qty.ToString();
                            dssImportHistory.data7          = dateTimeNow.ToString("MM/dd/yyyy");
                            dssImportHistory.data8          = dateTimeNow.ToString("HH:mm:ss");
                            dssImportHistory.data12         = mesScmsCompletedBox.OrderNo;
                            this.dssImportHistoryMgr.CreateDssImportHistory(dssImportHistory);

                            mesScmsCompletedBoxMgr.Complete(mesScmsCompletedBox);
                        }
                        catch (Exception e)
                        {
                            this.CleanSession();
                            log.Error(mesScmsCompletedBox.HuId + " complete exception", e);
                            continue;
                        }
                    }
                }
            }
            mesScmsTableIndexMgr.Complete(mesScmsTableIndex);
        }