コード例 #1
0
 /// <summary>
 /// VmiSupplierInfo -> VmiReceiveInfo
 /// </summary>
 /// <param name="vmiSupplierInfo"></param>
 /// <param name="vmiReceiveInfo"></param>
 public static void GetVmiReceiveInfo(VmiSupplierInfo vmiSupplierInfo, ref VmiReceiveInfo vmiReceiveInfo)
 {
     if (vmiSupplierInfo == null)
     {
         return;
     }
     ///ZONE_NO
     vmiReceiveInfo.ZoneNo = vmiSupplierInfo.ZoneNo;
 }
コード例 #2
0
        /// <summary>
        /// InsertInfo
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public long InsertInfo(VmiSupplierInfo info)
        {
            ///仓库代码①、存储区代码②、供应商代码③组合唯一性校验
            int cnt = dal.GetCounts(string.Format(@"[SUPPLIER_NUM] = N'{0}' and [WM_NO] = N'{1}' and [ZONE_NO] = N'{2}'", info.SupplierNum, info.WmNo, info.ZoneNo));

            if (cnt > 0)
            {
                throw new Exception("MC:0x00000098");///仓库、存储区、供应商组合需唯一
            }
            return(dal.Add(info));
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="supplierNums"></param>
        /// <returns></returns>
        public List <VmiSupplierInfo> GetListForInterfaceDataSync(List <string> supplierNums)
        {
            string sql = "select [ID],[SUPPLIER_NUM],[WM_NO] "
                         + "from [LES].[TM_BAS_VMI_SUPPLIER] with(nolock) "
                         + "where [VALID_FLAG] = 1 and [SUPPLIER_NUM] in ('" + string.Join("','", supplierNums.ToArray()) + "');";
            Database  db  = DatabaseFactory.CreateDatabase();
            DbCommand cmd = db.GetSqlStringCommand(sql);
            List <VmiSupplierInfo> list = new List <VmiSupplierInfo>();

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    VmiSupplierInfo info = new VmiSupplierInfo();
                    info.Id          = DBConvert.GetInt64(dr, dr.GetOrdinal("ID"));
                    info.SupplierNum = DBConvert.GetString(dr, dr.GetOrdinal("SUPPLIER_NUM"));
                    info.WmNo        = DBConvert.GetString(dr, dr.GetOrdinal("WM_NO"));
                    list.Add(info);
                }
            }
            return(list);
        }
コード例 #4
0
        /// <summary>
        /// Sync
        /// </summary>
        public static void Sync(string loginUser)
        {
            ///获取未处理的检验模式中间表数据
            List <WmsVmiTranDetailInfo> wmsVmiTranDetailInfos = new WmsVmiTranDetailBLL().GetList("[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (wmsVmiTranDetailInfos.Count == 0)
            {
                return;
            }
            StringBuilder @string = new StringBuilder();

            ///获取仓库信息
            List <WarehouseInfo> warehouseInfos = new WarehouseBLL().GetList("" +
                                                                             "[WAREHOUSE] in ('" + string.Join("','", wmsVmiTranDetailInfos.Select(d => d.VmiWarehouseCode).ToArray()) + "') "
                                                                             // + " and [WAREHOUSE_TYPE] = " + (int)WarehouseTypeConstants.VMI + ""
                                                                             , string.Empty);

            if (warehouseInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000230' where " +
                                   "[ID] in (" + string.Join(",", wmsVmiTranDetailInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取供应商信息
            List <SupplierInfo> supplierInfos = new SupplierBLL().GetList("" +
                                                                          "[SUPPLIER_NUM] in ('" + string.Join("','", wmsVmiTranDetailInfos.Select(d => d.SupplierCode).ToArray()) + "') and " +
                                                                          "[SUPPLIER_TYPE] = " + (int)SupplierTypeConstants.MaterialSupplier + "", string.Empty);

            if (supplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000229' where " +
                                   "[ID] in (" + string.Join(",", wmsVmiTranDetailInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取VMI供应商关系
            List <VmiSupplierInfo> vmiSupplierInfos = new VmiSupplierBLL().GetList("" +
                                                                                   "[SUPPLIER_NUM] in ('" + string.Join("','", supplierInfos.Select(d => d.SupplierNum).ToArray()) + "') and " +
                                                                                   "[WM_NO] in ('" + string.Join("','", warehouseInfos.Select(d => d.Warehouse).ToArray()) + "')", string.Empty);

            if (vmiSupplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000429' where " +
                                   "[ID] in (" + string.Join(",", wmsVmiTranDetailInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }

            ///获取相关物料基础信息
            List <MaintainPartsInfo> maintainPartsInfos = new MaintainPartsBLL().GetList("[PART_NO] in ('" + string.Join("','", wmsVmiTranDetailInfos.Select(d => d.PartNo).ToArray()) + "')", string.Empty);
            ///获取相关物料仓储信息
            List <PartsStockInfo> partsStockInfos = new PartsStockBLL().GetList("" +
                                                                                "[PART_NO] in ('" + string.Join("','", wmsVmiTranDetailInfos.Select(d => d.PartNo).ToArray()) + "') and " +
                                                                                "[WM_NO] in ('" + string.Join("','", warehouseInfos.Select(d => d.Warehouse).ToArray()) + "')", string.Empty);
            ///

            List <long> dealedIds = new List <long>();

            foreach (WmsVmiTranDetailInfo wmsVmiTranDetailInfo in wmsVmiTranDetailInfos)
            {
                var vmiWareHouseInfo = warehouseInfos.FirstOrDefault(fod => fod.Warehouse == wmsVmiTranDetailInfo.VmiWarehouseCode);
                if (vmiWareHouseInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000230' where " +///VMI供应商信息未维护
                                       "[ID] = " + wmsVmiTranDetailInfo.Id + ";");
                    continue;
                }
                if (vmiWareHouseInfo.WarehouseType != (int)WarehouseTypeConstants.VMI)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Processed + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000518' where " +///VMI供应商信息未维护
                                       "[ID] = " + wmsVmiTranDetailInfo.Id + ";");
                    continue;
                }

                ///VMI供应商关系
                VmiSupplierInfo vmiSupplierInfo = vmiSupplierInfos.FirstOrDefault(d => d.SupplierNum == wmsVmiTranDetailInfo.SupplierCode && d.WmNo == wmsVmiTranDetailInfo.VmiWarehouseCode);
                if (vmiSupplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000429' where " +///VMI供应商信息未维护
                                       "[ID] = " + wmsVmiTranDetailInfo.Id + ";");
                    continue;
                }
                if (!vmiSupplierInfo.VmiFlag.GetValueOrDefault())
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000466' where " +///该供应商未启用WMS功能
                                       "[ID] = " + wmsVmiTranDetailInfo.Id + ";");
                    continue;
                }
                if (string.IsNullOrEmpty(vmiSupplierInfo.ZoneNo))
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000481' where " +///VMI存储区未配置
                                       "[ID] = " + wmsVmiTranDetailInfo.Id + ";");
                    continue;
                }

                ///指定存储区
                wmsVmiTranDetailInfo.ZoneNo = vmiSupplierInfo.ZoneNo;
                ///创建交易
                TranDetailsInfo tranDetailsInfo = TranDetailsBLL.CreateTranDetailsInfo(loginUser);
                ///PartsStockInfo -> TranDetailsInfo
                PartsStockInfo partsStockInfo = partsStockInfos.FirstOrDefault(d =>
                                                                               d.PartNo == wmsVmiTranDetailInfo.PartNo && d.WmNo == vmiSupplierInfo.WmNo && d.ZoneNo == vmiSupplierInfo.ZoneNo);
                TranDetailsBLL.GetTranDetailsInfo(partsStockInfo, ref tranDetailsInfo);

                ///WmsVmiTranDetailInfo -> TranDetailsInfo
                wmsVmiTranDetailInfo.Dloc = partsStockInfo.Dloc;

                TranDetailsBLL.GetTranDetailsInfo(wmsVmiTranDetailInfo, ref tranDetailsInfo);
                ///MaintainPartsInfo -> TranDetailsInfo
                MaintainPartsInfo maintainPartsInfo = maintainPartsInfos.FirstOrDefault(d => d.PartNo == tranDetailsInfo.PartNo);
                TranDetailsBLL.GetTranDetailsInfo(maintainPartsInfo, ref tranDetailsInfo);

                ///SupplierInfo -> TranDetailsInfo
                SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == tranDetailsInfo.SupplierNum);
                TranDetailsBLL.GetTranDetailsInfo(supplierInfo, ref tranDetailsInfo);
                ///包装数量计算
                TranDetailsBLL.CalculateTranDetailsInfo(ref tranDetailsInfo);

                ///获取库存交易记录的生成语句
                @string.AppendLine(TranDetailsDAL.GetInsertSql(tranDetailsInfo));
                dealedIds.Add(wmsVmiTranDetailInfo.Id);
            }
            if (dealedIds.Count > 0)
            {
                ///已处理的中间表数据更新为已处理状态
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_TRAN_DETAIL] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Processed + "," +
                                   "[PROCESS_TIME] = GETDATE() where " +
                                   "[ID] in (" + string.Join(",", dealedIds.ToArray()) + ");");
            }
            ///执行
            using (var trans = new TransactionScope())
            {
                if (@string.Length > 0)
                {
                    BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
        }
コード例 #5
0
        /// <summary>
        /// Sync
        /// </summary>
        public static void Sync(string loginUser)
        {
            ///获取未处理的中间表数据
            List <WmsVmiAsnRunsheetInfo> wmsVmiAsnRunsheetInfos = new WmsVmiAsnRunsheetBLL().GetList("[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (wmsVmiAsnRunsheetInfos.Count == 0)
            {
                return;
            }
            List <WmsVmiAsnRunsheetDetailInfo> wmsVmiAsnRunsheetDetailInfos = new WmsVmiAsnRunsheetDetailBLL().GetList("[LOG_FID] in ('" + string.Join("','", wmsVmiAsnRunsheetInfos.Select(d => d.LogFid.GetValueOrDefault()).ToArray()) + "')", string.Empty);

            if (wmsVmiAsnRunsheetDetailInfos.Count == 0)
            {
                return;
            }
            ///获取相关物料供应商信息
            List <SupplierInfo> supplierInfos = new SupplierBLL().GetList("" +
                                                                          "[SUPPLIER_NUM] in ('" + string.Join("','", wmsVmiAsnRunsheetInfos.Select(d => d.Suppliercode).ToArray()) + "') and " +
                                                                          "[SUPPLIER_TYPE] = " + (int)SupplierTypeConstants.MaterialSupplier + "", string.Empty);
            ///
            StringBuilder @string = new StringBuilder();

            if (supplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000475' where " +///送货单中供应商信息无效
                                   "[ID] in (" + string.Join("','", wmsVmiAsnRunsheetInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取相关存储区信息
            List <string> zoneNos = wmsVmiAsnRunsheetInfos.Where(d => !string.IsNullOrEmpty(d.Targetzoneno)).Select(d => d.Targetzoneno).ToList();

            zoneNos.AddRange(wmsVmiAsnRunsheetInfos.Where(d => !string.IsNullOrEmpty(d.Sourcezoneno)).Select(d => d.Sourcezoneno).ToList());
            List <ZonesInfo> zonesInfos = new ZonesBLL().GetList("" +
                                                                 "[ZONE_NO] in ('" + string.Join("','", zoneNos.ToArray()) + "')  ", string.Empty);

            if (zonesInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000485' where " +///送货单中存储区信息不存在
                                   "[ID] in (" + string.Join(",", wmsVmiAsnRunsheetInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取相关仓库信息
            List <WarehouseInfo> warehouseInfos = new WarehouseBLL().GetList("[WAREHOUSE] in ('" + string.Join("','", zonesInfos.Select(d => d.WmNo).ToArray()) + "')", string.Empty);

            if (warehouseInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000230' where " +///仓库信息不存在
                                   "[ID] in (" + string.Join("','", wmsVmiAsnRunsheetInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///供应商VMI关系
            List <VmiSupplierInfo> vmiSupplierInfos = new VmiSupplierBLL().GetList("" +
                                                                                   "[SUPPLIER_NUM] in ('" + string.Join("','", supplierInfos.Select(d => d.SupplierNum).ToArray()) + "') and " +
                                                                                   "[WM_NO] in ('" + string.Join("','", warehouseInfos.Select(d => d.Warehouse).ToArray()) + "')", string.Empty);

            if (vmiSupplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000429' where " +///VMI供应商信息未维护
                                   "[ID] in (" + string.Join("','", wmsVmiAsnRunsheetInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }

            ///
            List <long> dealedIds = new List <long>();

            ///循环写入数据
            foreach (WmsVmiAsnRunsheetInfo wmsVmiAsnRunsheetInfo in wmsVmiAsnRunsheetInfos)
            {
                ///获取送货单明细
                List <WmsVmiAsnRunsheetDetailInfo> wmsVmiAsnRunsheetDetails = wmsVmiAsnRunsheetDetailInfos.Where(d => d.OrderFid.GetValueOrDefault() == wmsVmiAsnRunsheetInfo.LogFid.GetValueOrDefault()).ToList();
                if (wmsVmiAsnRunsheetDetails.Count == 0)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000473' where " +///送货单无物料明细
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }
                ///供应商信息
                SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == wmsVmiAsnRunsheetInfo.Suppliercode);
                if (supplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000484' where " +///该送货单中供应商信息不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }
                var sourceZoneInfo = zonesInfos.FirstOrDefault(fd => fd.ZoneNo == wmsVmiAsnRunsheetInfo.Sourcezoneno);
                if (sourceZoneInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000500' where " +///存储区不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }


                ///来源仓库
                WarehouseInfo sourceWarehouseInfo = warehouseInfos.FirstOrDefault(d => d.Warehouse == sourceZoneInfo.WmNo);
                if (sourceWarehouseInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000230' where " +///仓库信息不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }


                if (sourceWarehouseInfo.WarehouseType.GetValueOrDefault() != (int)WarehouseTypeConstants.VMI)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000219' where " +///仓库类型错误
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }


                var targetZoneInfo = zonesInfos.FirstOrDefault(fd => fd.ZoneNo == wmsVmiAsnRunsheetInfo.Targetzoneno);
                if (targetZoneInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000500' where " +///存储区不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }

                ///来源仓库
                WarehouseInfo targetWarehouseInfo = warehouseInfos.FirstOrDefault(d => d.Warehouse == targetZoneInfo.WmNo);
                if (targetWarehouseInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000230' where " +///仓库信息不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }
                if (targetWarehouseInfo.WarehouseType.GetValueOrDefault() != (int)WarehouseTypeConstants.RDC)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000219' where " +///存储区不存在
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }
                ///VMI供应商关系
                VmiSupplierInfo vmiSupplierInfo = vmiSupplierInfos.FirstOrDefault(d => d.SupplierNum == supplierInfo.SupplierNum && d.WmNo == sourceWarehouseInfo.Warehouse);
                if (vmiSupplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000429' where " +///VMI供应商信息未维护
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }
                if (!vmiSupplierInfo.AsnFlag.GetValueOrDefault())
                {
                    @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000486' where " +///该供应商未启用ASN功能
                                       "[ID] = " + wmsVmiAsnRunsheetInfo.Id + ";");
                    continue;
                }

                ///单据衔接对象创建
                MaterialPullingOrderInfo materialPullingOrderInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo();
                ///WmsVmiAsnRunsheetInfo -> MaterialPullingOrderInfo
                MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(wmsVmiAsnRunsheetInfo, ref materialPullingOrderInfo);
                ///
                materialPullingOrderInfo.SourceWmNo = sourceWarehouseInfo.Warehouse;
                ///
                materialPullingOrderInfo.TargetWmNo = targetWarehouseInfo.Warehouse;
                ///
                materialPullingOrderInfo.AsnFlag = true;
                ///PART_BOX_CODE,TODO:考虑由WMS增加字段?
                materialPullingOrderInfo.PartBoxCode = string.Empty;
                ///PART_BOX_NAME,11
                materialPullingOrderInfo.PartBoxName = string.Empty;
                ///
                materialPullingOrderInfo.Route = null;
                ///
                foreach (WmsVmiAsnRunsheetDetailInfo wmsVmiAsnRunsheetDetail in wmsVmiAsnRunsheetDetails)
                {
                    ///单据衔接明细对象创建
                    MaterialPullingOrderDetailInfo materialPullingOrderDetailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo();
                    ///WmsVmiAsnRunsheetDetailInfo -> MaterialPullingOrderDetailInfo
                    MaterialPullingCommonBLL.GetMaterialPullingOrderDetailInfo(wmsVmiAsnRunsheetDetail, ref materialPullingOrderDetailInfo);
                    ///WMS拉动单明细中的供应商必须为单据的供应商
                    materialPullingOrderDetailInfo.SupplierNum = wmsVmiAsnRunsheetInfo.Suppliercode;
                    ///
                    materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Add(materialPullingOrderDetailInfo);
                }
                ///生成创建入库单的语句
                @string.Append(MaterialPullingCommonBLL.CreateReceiveSql(materialPullingOrderInfo, new List <PartsStockInfo>(), loginUser));
                ///执行成功的ID
                dealedIds.Add(wmsVmiAsnRunsheetInfo.Id);
            }
            if (dealedIds.Count > 0)
            {
                ///已处理的中间表数据更新为已处理状态
                @string.AppendLine("update [LES].[TI_IFM_WMS_VMI_ASN_RUNSHEET] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Processed + "," +
                                   "[PROCESS_TIME] = GETDATE() where " +
                                   "[ID] in (" + string.Join(",", dealedIds.ToArray()) + ");");
            }
            ///执行
            using (TransactionScope trans = new TransactionScope())
            {
                if (@string.Length > 0)
                {
                    BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
        }
コード例 #6
0
        /// <summary>
        /// 供应商发货单同步
        /// </summary>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public static void Sync(string loginUser)
        {
            ///获取没有处理的物料发货单表
            List <SrmVmiShippingNoteInfo> srmVmiShippingNoteInfos = new SrmVmiShippingNoteBLL().GetList("[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", "[ID]");

            if (srmVmiShippingNoteInfos.Count == 0)
            {
                return;
            }
            ///获取没有处理的物料发货单详情表
            List <SrmVmiShippingNoteDetailInfo> srmVmiShippingNoteDetailInfos = new SrmVmiShippingNoteDetailBLL().GetList("[NOTE_FID] in ('" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.LogFid).ToArray()) + "')", "[ID]");

            if (srmVmiShippingNoteDetailInfos.Count == 0)
            {
                return;
            }
            StringBuilder @string = new StringBuilder();
            ///获取相关仓库信息
            List <WarehouseInfo> warehouseInfos = new WarehouseBLL().GetList("[WAREHOUSE] in ('" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.VmiWmNo).ToArray()) + "')", string.Empty);

            if (warehouseInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000230' where " +///仓库信息不存在
                                   "[ID] in (" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取相关供应商基础信息
            List <SupplierInfo> supplierInfos = new SupplierBLL().GetList("[SUPPLIER_NUM] in ('" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.SupplierCode).ToArray()) + "')", string.Empty);

            if (supplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000229' where " +///供应商信息不存在
                                   "[ID] in (" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取VMI供应商关系
            List <VmiSupplierInfo> vmiSupplierInfos = new VmiSupplierBLL().GetList("" +
                                                                                   "[SUPPLIER_NUM] in ('" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.SupplierCode).ToArray()) + "') and " +
                                                                                   "[WM_NO] in ('" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.VmiWmNo).ToArray()) + "')", string.Empty);

            if (vmiSupplierInfos.Count == 0)
            {
                @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                   "[PROCESS_TIME] = GETDATE()," +
                                   "[COMMENTS] = N'0x00000429' where " +///VMI供应商信息未维护
                                   "[ID] in (" + string.Join("','", srmVmiShippingNoteInfos.Select(d => d.Id).ToArray()) + ");");
                BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                return;
            }
            ///获取相关物料基础信息
            List <MaintainPartsInfo> maintainPartsInfos = new MaintainPartsBLL().GetList("" +
                                                                                         "[PART_NO] in ('" + string.Join("','", srmVmiShippingNoteDetailInfos.Select(d => d.Partno).ToArray()) + "')", string.Empty);
            ///获取相关物料仓储信息
            List <PartsStockInfo> partsStockInfos = new PartsStockBLL().GetList("" +
                                                                                "[PART_NO] in ('" + string.Join("','", srmVmiShippingNoteDetailInfos.Select(d => d.Partno).ToArray()) + "') and " +
                                                                                "[WM_NO] in ('" + string.Join("','", warehouseInfos.Select(d => d.Warehouse).ToArray()) + "')", string.Empty);
            ///获取相关包装器具基础信息
            List <PackageApplianceInfo> packageApplianceInfos = new List <PackageApplianceInfo>();

            if (partsStockInfos.Count > 0)
            {
                ///标准包装
                List <string> packageModels = partsStockInfos.
                                              Where(d => !string.IsNullOrEmpty(d.PackageModel)).
                                              Select(d => d.PackageModel).ToList();
                ///入库包装
                packageModels.AddRange(partsStockInfos.
                                       Where(d => !string.IsNullOrEmpty(d.InboundPackageModel) && !packageModels.Contains(d.InboundPackageModel)).
                                       Select(d => d.InboundPackageModel).ToList());
                ///上线包装
                packageModels.AddRange(partsStockInfos.
                                       Where(d => !string.IsNullOrEmpty(d.InhousePackageModel) && !packageModels.Contains(d.InhousePackageModel)).
                                       Select(d => d.InhousePackageModel).ToList());
                ///
                packageApplianceInfos = new PackageApplianceBLL().GetList("[PAKCAGE_NO] in ('" + string.Join("','", packageModels.ToArray()) + "')", string.Empty);
            }

            ///获取系统配置
            Dictionary <string, string> configs = new ConfigBLL().GetValuesByCodes(new string[] {
                "RELEASE_VMI_RECEIVE_ACTUAL_QTY_EQUALS_REQUIRED",
                "ENABLE_VMI_FLAG"
            });
            ///
            List <long> dealedIds = new List <long>();

            ///如果数据不为空,按照规则分发
            foreach (SrmVmiShippingNoteInfo srmVmiShippingNoteInfo in srmVmiShippingNoteInfos)
            {
                ///本单据的对应仓库
                WarehouseInfo warehouseInfo = warehouseInfos.FirstOrDefault(d => d.Warehouse == srmVmiShippingNoteInfo.VmiWmNo);
                ///如果未处理的物料发货单中仓库码不存在, 修改中间表数据为挂起状态
                if (warehouseInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000230' where " +///仓库信息不存在
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }
                ///仓库类型不是VMI
                if (warehouseInfo.WarehouseType.GetValueOrDefault() != (int)WarehouseTypeConstants.VMI)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000219' where " +///仓库类型错误
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }
                ///本发货单的物料明细
                List <SrmVmiShippingNoteDetailInfo> srmVmiShippingNoteDetails = srmVmiShippingNoteDetailInfos.Where(d =>
                                                                                                                    d.NoteFid.GetValueOrDefault() == srmVmiShippingNoteInfo.Fid).ToList();
                if (srmVmiShippingNoteDetails.Count == 0)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000465' where " +///发货单物料数据错误
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }
                ///供应商
                SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == srmVmiShippingNoteInfo.SupplierCode);
                if (supplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000229' where " +///供应商信息不存在
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }
                ///VMI供应商关系
                VmiSupplierInfo vmiSupplierInfo = vmiSupplierInfos.FirstOrDefault(d => d.SupplierNum == supplierInfo.SupplierNum && d.WmNo == warehouseInfo.Warehouse);
                if (vmiSupplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000429' where " +///VMI供应商信息未维护
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }

                ///如果该仓库启用的是VMI模块则需要将单据写入VMI入库单
                if (warehouseInfo.VmiEnable.GetValueOrDefault())
                {
                    ///发布VMI入库单时实收数量默认等于需求数量
                    configs.TryGetValue("RELEASE_VMI_RECEIVE_ACTUAL_QTY_EQUALS_REQUIRED", out string release_vmi_receive_actual_qty_equals_required);
                    ///创建VMI入库单,TODO:默认类型与状态
                    VmiReceiveInfo vmiReceiveInfo = VmiReceiveBLL.CreateVmiReceiveInfo(
                        loginUser,
                        (int)VmiReceiveTypeConstants.ProductionWarehousing,
                        (int)WmmOrderStatusConstants.Published);
                    ///SrmVmiShippingNoteInfo -> VmiReceiveInfo
                    VmiReceiveBLL.GetVmiReceiveInfo(srmVmiShippingNoteInfo, ref vmiReceiveInfo);
                    ///SupplierInfo -> VmiReceiveInfo
                    VmiReceiveBLL.GetVmiReceiveInfo(supplierInfo, ref vmiReceiveInfo);
                    ///VmiSupplierInfo -> VmiReceiveInfo
                    VmiReceiveBLL.GetVmiReceiveInfo(vmiSupplierInfo, ref vmiReceiveInfo);
                    ///生成入库单语句
                    @string.AppendLine(VmiReceiveDAL.GetInsertSql(vmiReceiveInfo));
                    ///
                    foreach (SrmVmiShippingNoteDetailInfo srmVmiShippingNoteDetail in srmVmiShippingNoteDetails)
                    {
                        ///创建VMI入库单明细
                        VmiReceiveDetailInfo vmiReceiveDetailInfo = VmiReceiveDetailBLL.CreateVmiReceiveDetailInfo(loginUser);
                        ///VmiReceiveInfo -> VmiReceiveDetailInfo
                        VmiReceiveDetailBLL.GetVmiReceiveDetailInfo(vmiReceiveInfo, ref vmiReceiveDetailInfo);
                        ///MaintainPartsInfo -> VmiReceiveDetailInfo
                        MaintainPartsInfo maintainPartsInfo = maintainPartsInfos.FirstOrDefault(d => d.PartNo == srmVmiShippingNoteDetail.Partno);
                        VmiReceiveDetailBLL.GetVmiReceiveDetailInfo(maintainPartsInfo, ref vmiReceiveDetailInfo);
                        ///PartsStockInfo -> VmiReceiveDetailInfo
                        PartsStockInfo partsStockInfo = partsStockInfos.FirstOrDefault(d => d.PartNo == srmVmiShippingNoteDetail.Partno && d.WmNo == warehouseInfo.Warehouse);
                        VmiReceiveDetailBLL.GetVmiReceiveDetailInfo(partsStockInfo, ref vmiReceiveDetailInfo);
                        ///PackageApplianceInfo -> VmiReceiveDetailInfo
                        PackageApplianceInfo packageApplianceInfo = partsStockInfo == null ? null : packageApplianceInfos.FirstOrDefault(d => d.PackageNo == partsStockInfo.InboundPackageModel);
                        VmiReceiveDetailBLL.GetVmiReceiveDetailInfo(packageApplianceInfo, ref vmiReceiveDetailInfo);
                        ///SrmVmiShippingNoteDetailInfo -> VmiReceiveDetailInfo
                        VmiReceiveDetailBLL.GetVmiReceiveDetailInfo(srmVmiShippingNoteDetail, ref vmiReceiveDetailInfo);
                        ///发布VMI入库单时实收数量默认等于需求数量
                        if (!string.IsNullOrEmpty(release_vmi_receive_actual_qty_equals_required) && release_vmi_receive_actual_qty_equals_required.ToLower() == "true")
                        {
                            ///ACTUAL_BOX_NUM
                            vmiReceiveDetailInfo.ActualBoxNum = vmiReceiveDetailInfo.RequiredBoxNum;
                            ///ACTUAL_QTY
                            vmiReceiveDetailInfo.ActualQty = vmiReceiveDetailInfo.RequiredQty;
                        }
                        ///生成入库单明细语句
                        @string.AppendLine(VmiReceiveDetailDAL.GetInsertSql(vmiReceiveDetailInfo));
                    }
                    dealedIds.Add(srmVmiShippingNoteInfo.Id);
                }
                ///如果未启用VMI模块,则根据WMS系统开关决定是否写入中间表
                else
                {
                    ///是否启用WMS系统标记
                    configs.TryGetValue("ENABLE_VMI_FLAG", out string enable_vmi_flag);
                    if (!string.IsNullOrEmpty(enable_vmi_flag) && enable_vmi_flag.ToLower() == "true" && vmiSupplierInfo.VmiFlag.GetValueOrDefault())
                    {
                        ///创建WMS入库单
                        WmsVmiInboundOrderInfo wmsVmiInboundOrderInfo = WmsVmiInboundOrderBLL.CreateWmsVmiInboundOrderInfo((int)ProcessFlagConstants.Untreated, loginUser);
                        ///SrmVmiShippingNoteInfo -> WmsVmiInboundOrderInfo
                        WmsVmiInboundOrderBLL.GetWmsVmiInboundOrderInfo(srmVmiShippingNoteInfo, ref wmsVmiInboundOrderInfo);
                        ///生成入库单语句
                        @string.AppendLine(WmsVmiInboundOrderDAL.GetInsertSql(wmsVmiInboundOrderInfo));
                        ///
                        foreach (SrmVmiShippingNoteDetailInfo srmVmiShippingNoteDetail in srmVmiShippingNoteDetails)
                        {
                            ///创建WMS入库单明细
                            WmsVmiInboundOrderDetailInfo wmsVmiInboundOrderDetailInfo = WmsVmiInboundOrderDetailBLL.CreateWmsVmiInboundOrderDetailInfo(loginUser);
                            ///WmsVmiInboundOrderInfo -> WmsVmiInboundOrderDetailInfo
                            WmsVmiInboundOrderDetailBLL.GetWmsVmiInboundOrderDetailInfo(wmsVmiInboundOrderInfo, ref wmsVmiInboundOrderDetailInfo);
                            ///
                            PartsStockInfo partsStockInfo = partsStockInfos.FirstOrDefault(d => d.PartNo == srmVmiShippingNoteDetail.Partno && d.WmNo == warehouseInfo.Warehouse);
                            WmsVmiInboundOrderDetailBLL.GetWmsVmiInboundOrderDetailInfo(partsStockInfo, ref wmsVmiInboundOrderDetailInfo);
                            ///SrmVmiShippingNoteDetailInfo -> WmsVmiInboundOrderDetailInfo
                            WmsVmiInboundOrderDetailBLL.GetWmsVmiInboundOrderDetailInfo(srmVmiShippingNoteDetail, ref wmsVmiInboundOrderDetailInfo);
                            ///生成WMS入库单明细语句
                            @string.AppendLine(WmsVmiInboundOrderDetailDAL.GetInsertSql(wmsVmiInboundOrderDetailInfo));
                        }
                        ///
                        string targetSystem = "VMI";
                        string methodCode   = "LES-WMS-001";
                        @string.AppendLine(BLL.LES.CommonBLL.GetCreateOutboundLogSql(
                                               targetSystem,
                                               wmsVmiInboundOrderInfo.LogFid.GetValueOrDefault(),
                                               methodCode,
                                               srmVmiShippingNoteInfo.ShippingCode,
                                               loginUser));
                        dealedIds.Add(srmVmiShippingNoteInfo.Id);
                        continue;
                    }
                    @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000466' where " +///该供应商未启用WMS功能
                                       "[ID] = " + srmVmiShippingNoteInfo.Id + ";");
                    continue;
                }
            }
            if (dealedIds.Count > 0)
            {
                ///已处理的中间表数据更新为已处理状态
                @string.AppendLine("update [LES].[TI_IFM_SRM_VMI_SHIPPING_NOTE] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Processed + "," +
                                   "[PROCESS_TIME] = GETDATE() where " +
                                   "[ID] in (" + string.Join(",", dealedIds.ToArray()) + ");");
            }
            ///执行
            using (var trans = new TransactionScope())
            {
                if (@string.Length > 0)
                {
                    BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
        }
コード例 #7
0
        /// <summary>
        /// 执行导入EXCEL数据
        /// </summary>
        /// <param name="dataTable"></param>
        /// <param name="fieldNames"></param>
        /// <returns></returns>
        public bool ImportDataByExcel(DataTable dataTable, Dictionary <string, string> fieldNames, string loginUser)
        {
            List <VmiSupplierInfo> vmiSupplierExcelInfos = CommonDAL.DatatableConvertToList <VmiSupplierInfo>(dataTable).ToList();

            if (vmiSupplierExcelInfos.Count == 0)
            {
                throw new Exception("MC:1x00000043");///数据格式不符合导入规范
            }
            ///获取业务表中要变更的数据集合,准备对比
            List <VmiSupplierInfo> vmiSupplierInfos = new VmiSupplierDAL().GetListForInterfaceDataSync(vmiSupplierExcelInfos.Select(d => d.SupplierNum).ToList());
            List <SupplierInfo>    supplierInfos    = new SupplierDAL().GetListForInterfaceDataSync(vmiSupplierExcelInfos.Select(d => d.SupplierNum).ToList());
            List <WarehouseInfo>   warehouseInfos   = new WarehouseDAL().GetListForInterfaceDataSync(vmiSupplierExcelInfos.Select(d => d.WmNo).ToList());
            ///执行的SQL语句
            string sql = string.Empty;

            List <string> fields = new List <string>(fieldNames.Keys);

            ///逐条处理中间表数据
            foreach (var vmiSupplierExcelInfo in vmiSupplierExcelInfos)
            {
                ///当前业务数据表中此工厂的该物流路线时需要新增
                VmiSupplierInfo vmiSupplierInfo = vmiSupplierInfos.FirstOrDefault(d => d.SupplierNum == vmiSupplierExcelInfo.SupplierNum &&
                                                                                  d.WmNo == vmiSupplierExcelInfo.WmNo);
                SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == vmiSupplierExcelInfo.SupplierNum);
                if (supplierInfo == null)
                {
                    throw new Exception("MC:0x00000229");///供应商信息不存在
                }
                WarehouseInfo warehouseInfo = warehouseInfos.FirstOrDefault(d => d.Warehouse == vmiSupplierExcelInfo.WmNo);
                if (warehouseInfo == null)
                {
                    throw new Exception("MC:0x00000230");///仓库信息不存在
                }
                vmiSupplierExcelInfo.SupplierName = supplierInfo.SupplierName;

                if (vmiSupplierInfo == null)
                {
                    if (string.IsNullOrEmpty(vmiSupplierExcelInfo.SupplierNum) ||
                        string.IsNullOrEmpty(vmiSupplierExcelInfo.WmNo))
                    {
                        throw new Exception("MC:0x00000228");///供应商与仓库为必填项
                    }
                    ///字段
                    string insertFieldString = string.Empty;
                    ///值
                    string insertValueString = string.Empty;
                    for (int i = 0; i < fields.Count; i++)
                    {
                        string valueStr = CommonDAL.GetFieldValueForSql <VmiSupplierInfo>(vmiSupplierExcelInfo, fields[i]);
                        if (string.IsNullOrEmpty(valueStr))
                        {
                            throw new Exception("MC:1x00000043");///数据格式不符合导入规范
                        }
                        insertFieldString += "[" + fieldNames[fields[i]] + "],";
                        insertValueString += valueStr + ",";
                    }
                    ///判断业务主键是否重复,以防止EXCEL中有重复数据,适用于基础数据导入
                    sql += "if not exists (select * from LES.TM_BAS_VMI_SUPPLIER with(nolock) "
                           + "where [SUPPLIER_NUM] = N'" + vmiSupplierExcelInfo.SupplierNum + "' and [WM_NO] = N'" + vmiSupplierExcelInfo.WmNo + "' and [VALID_FLAG] = 1)"
                           + " insert into [LES].[TM_BAS_VMI_SUPPLIER] ("
                           + "[FID],"
                           + insertFieldString
                           + "[CREATE_USER],"
                           + "[CREATE_DATE],"
                           + "[VALID_FLAG]"
                           + ") values ("
                           + "NEWID(),"              ///FID
                           + insertValueString
                           + "N'" + loginUser + "'," ///CREATE_USER
                           + "GETDATE(),"            ///CREATE_DATE
                           + "1"                     ///VALID_FLAG
                           + ");";
                    continue;
                }

                if (string.IsNullOrEmpty(vmiSupplierExcelInfo.SupplierNum) ||
                    string.IsNullOrEmpty(vmiSupplierExcelInfo.WmNo))
                {
                    throw new Exception("MC:0x00000228");///供应商与仓库为必填项
                }
                ///值
                string valueString = string.Empty;
                for (int i = 0; i < fields.Count; i++)
                {
                    string valueStr = CommonDAL.GetFieldValueForSql <VmiSupplierInfo>(vmiSupplierExcelInfo, fields[i]);
                    if (string.IsNullOrEmpty(valueStr))
                    {
                        throw new Exception("MC:1x00000043");///数据格式不符合导入规范
                    }
                    valueString += "[" + fieldNames[fields[i]] + "] = " + valueStr + ",";
                }
                sql += "update [LES].[TM_BAS_VMI_SUPPLIER] set "
                       + valueString
                       + "[MODIFY_USER] = N'" + loginUser + "',"
                       + "[MODIFY_DATE] = GETDATE() "
                       + "where [ID] = " + vmiSupplierInfo.Id + ";";
            }
            ///
            if (string.IsNullOrEmpty(sql))
            {
                return(false);
            }

            return(CommonDAL.ExecuteNonQueryBySql(sql));
        }