コード例 #1
0
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public bool LogicDeleteInfo(long id, string loginUser)
        {
            ///入库单必须为已创建状态
            VmiReceiveInfo info = dal.GetInfo(id);

            if (info.Status != (int)WmmOrderStatusConstants.Created)
            {
                throw new Exception("MC:0x00000683");///状态必须为已创建
            }
            ///
            StringBuilder @string = new StringBuilder();

            @string.AppendLine("update [LES].[TT_WMM_VMI_RECEIVE_DETAIL] set " +
                               "[VALID_FLAG] = 0," +
                               "[MODIFY_DATE] = GETDATE()," +
                               "[MODIFY_USER] = N'" + loginUser + "' " +
                               "where [RECEIVE_FID] = N'" + info.Fid.GetValueOrDefault() + "';");
            @string.AppendLine("update [LES].[TT_WMM_VMI_RECEIVE] set " +
                               "[VALID_FLAG] = 0," +
                               "[MODIFY_DATE] = GETDATE()," +
                               "[MODIFY_USER] = N'" + loginUser + "' " +
                               "where [ID] = " + id + ";");
            ///执行
            using (var trans = new TransactionScope())
            {
                CommonDAL.ExecuteNonQueryBySql(@string.ToString());
                trans.Complete();
            }
            return(true);
        }
コード例 #2
0
 /// <summary>
 /// VmiReceiveInfo -> VmiReceiveDetailInfo
 /// </summary>
 /// <param name="vmiReceiveInfo"></param>
 /// <param name="vmiReceiveDetailInfo"></param>
 public static void GetVmiReceiveDetailInfo(VmiReceiveInfo vmiReceiveInfo, ref VmiReceiveDetailInfo vmiReceiveDetailInfo)
 {
     if (vmiReceiveInfo == null)
     {
         return;
     }
     ///RECEIVE_FID
     vmiReceiveDetailInfo.ReceiveFid = vmiReceiveInfo.Fid;
     ///PLANT
     vmiReceiveDetailInfo.Plant = vmiReceiveInfo.Plant;
     ///SUPPLIER_NUM
     vmiReceiveDetailInfo.SupplierNum = vmiReceiveInfo.SupplierNum;
     ///WM_NO
     vmiReceiveDetailInfo.WmNo = vmiReceiveInfo.SourceWmNo;
     ///ZONE_NO
     vmiReceiveDetailInfo.ZoneNo = vmiReceiveInfo.SourceZoneNo;
     ///TARGET_WM
     vmiReceiveDetailInfo.TargetWm = vmiReceiveInfo.WmNo;
     ///TARGET_ZONE
     vmiReceiveDetailInfo.TargetZone = vmiReceiveInfo.ZoneNo;
     ///TRAN_NO
     vmiReceiveDetailInfo.TranNo = vmiReceiveInfo.ReceiveNo;
     ///DOCK
     vmiReceiveDetailInfo.Dock = vmiReceiveInfo.Dock;
     ///RUNSHEET_NO
     vmiReceiveDetailInfo.RunsheetNo = vmiReceiveInfo.RunsheetNo;
 }
コード例 #3
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;
 }
コード例 #4
0
 /// <summary>
 /// SupplierInfo -> VmiReceiveInfo
 /// </summary>
 /// <param name="supplierInfo"></param>
 /// <param name="vmiReceiveInfo"></param>
 public static void GetVmiReceiveInfo(SupplierInfo supplierInfo, ref VmiReceiveInfo vmiReceiveInfo)
 {
     if (supplierInfo == null)
     {
         return;
     }
     ///SUPPLIER_TYPE
     vmiReceiveInfo.SupplierType = supplierInfo.SupplierType;
 }
コード例 #5
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public long InsertInfo(VmiReceiveInfo info)
 {
     ///入库单号①系统自动根据规则创建
     info.ReceiveNo = new SeqDefineDAL().GetCurrentCode("VMI_RECEIVE_NO");
     ///
     info.Status = (int)WmmOrderStatusConstants.Created;
     ///填充供应商类型,只能是物料供应商
     if (!string.IsNullOrEmpty(info.SupplierNum))
     {
         info.SupplierType = (int)SupplierTypeConstants.MaterialSupplier;
     }
     return(dal.Add(info));
 }
コード例 #6
0
        /// <summary>
        /// 关闭(作废)
        /// </summary>
        /// <param name="id"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public bool CloseInfo(long id, string loginUser)
        {
            ///入库单必须为已发布状态⑫才可以进行关单操作
            ///作完成后将已发布状态⑫更改为90.已关单状态
            VmiReceiveInfo info = dal.GetInfo(id);

            if (info == null)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            if (info.Status != (int)WmmOrderStatusConstants.Published)
            {
                throw new Exception("MC:0x00000735");///入库单必须为已发布状态
            }
            string sql = "[STATUS] = " + (int)WmmOrderStatusConstants.Closed + ",[MODIFY_USER] = N'" + loginUser + "' ,[MODIFY_DATE] = GETDATE()";

            return(dal.UpdateInfo(sql, id) > 0 ? true : false);
        }
コード例 #7
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            ///状态⑫为10.已创建的入库单可以进行修改
            VmiReceiveInfo info = dal.GetInfo(id);

            if (info.Status != (int)WmmOrderStatusConstants.Created)
            {
                throw new Exception("MC:0x00000683");///状态必须为已创建
            }
            ///供应商,对于VMI来说明细中的供应商就是单据的供应商
            StringBuilder @string     = new StringBuilder();
            string        supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM");
            string        loginUser   = CommonBLL.GetFieldValue(fields, "MODIFY_USER");

            if (!string.IsNullOrEmpty(supplierNum) && info.SupplierNum != supplierNum)
            {
                @string.AppendLine("" +
                                   "update [LES].[TT_WMM_VMI_RECEIVE_DETAIL] set " +
                                   "[SUPPLIER_NUM] = N'" + supplierNum + "'," +
                                   "[MODIFY_DATE] = GETDATE()," +
                                   "[MODIFY_USER] = N'" + loginUser + "' " +
                                   "where [RECEIVE_FID] = N'" + info.Fid.GetValueOrDefault() + "';");
            }
            ///执行
            using (var trans = new TransactionScope())
            {
                if (dal.UpdateInfo(fields, id) == 0)
                {
                    return(false);
                }
                if (@string.Length > 0)
                {
                    CommonDAL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
            return(true);
        }
コード例 #8
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();
            }
        }
コード例 #9
0
 /// <summary>
 /// SrmVmiShippingNoteInfo -> VmiReceiveInfo
 /// </summary>
 /// <param name="srmVmiShippingNoteInfo"></param>
 /// <param name="vmiReceiveInfo"></param>
 public static void GetVmiReceiveInfo(SrmVmiShippingNoteInfo srmVmiShippingNoteInfo, ref VmiReceiveInfo vmiReceiveInfo)
 {
     if (srmVmiShippingNoteInfo == null)
     {
         return;
     }
     ///PLANT
     vmiReceiveInfo.Plant = srmVmiShippingNoteInfo.Plant;
     ///RUNSHEET_NO
     vmiReceiveInfo.RunsheetNo = srmVmiShippingNoteInfo.ShippingCode;
     ///SUPPLIER_NUM
     vmiReceiveInfo.SupplierNum = srmVmiShippingNoteInfo.SupplierCode;
     ///PLAN_DELIVERY_TIME
     vmiReceiveInfo.PlanDeliveryTime = srmVmiShippingNoteInfo.DeliveryTime;
     ///WM_NO
     vmiReceiveInfo.WmNo = srmVmiShippingNoteInfo.VmiWmNo;
 }
コード例 #10
0
        /// <summary>
        /// Create VmiReceiveInfo
        /// </summary>
        /// <param name="loginUser"></param>
        /// <param name="receiveType"></param>
        /// <param name="status"></param>
        /// <returns>VmiReceiveInfo</returns>
        public static VmiReceiveInfo CreateVmiReceiveInfo(string loginUser, int receiveType, int status)
        {
            VmiReceiveInfo vmiReceiveInfo = new VmiReceiveInfo
            {
                ///FID
                Fid = Guid.NewGuid(),
                ///VALID_FLAG
                ValidFlag = true,
                ///CREATE_DATE
                CreateDate = DateTime.Now,
                ///CREATE_USER
                CreateUser = loginUser,
                ///RECEIVE_NO
                ReceiveNo = new SeqDefineDAL().GetCurrentCode("VMI_RECEIVE_NO"),
                ///RECEIVE_TYPE
                ReceiveType = receiveType,
                ///SEND_TIME
                SendTime = DateTime.Now,
                ///STATUS
                Status = status,
                ///TRUST_TIME
                TrustTime = DateTime.Now,
                ///SOURCE_WM_NO
                SourceWmNo = string.Empty,
                ///SOURCE_ZONE_NO
                SourceZoneNo = string.Empty,
                ///DOCK
                Dock = string.Empty,
                ///TRAN_TIME
                TranTime = null,
                ///RECEIVE_REASON
                ReceiveReason = string.Empty,
                ///BOOK_KEEPER
                BookKeeper = string.Empty,
                ///ASN_NO
                AsnNo = string.Empty,
                ///PRINT_COUNT
                PrintCount = null,
                ///PRINT_TIME
                PrintTime = null,
                ///LAST_PRINT_USER
                LastPrintUser = string.Empty,
                ///IS_OUTPUT
                IsOutput = null,
                ///ORGANIZATION_FID
                OrganizationFid = null,
                ///COST_CENTER
                CostCenter = string.Empty,
                ///CONFIRM_USER
                ConfirmUser = string.Empty,
                ///CONFIRM_DATE
                ConfirmDate = null,
                ///LIABLE_USER
                LiableUser = string.Empty,
                ///LIABLE_DATE
                LiableDate = null,
                ///FINANCE_USER
                FinanceUser = string.Empty,
                ///FINANCE_DATE
                FinanceDate = null,
                ///PART_BOX_CODE
                PartBoxCode = string.Empty,
                ///PART_BOX_NAME
                PartBoxName = string.Empty,
                ///INSPECTION_FLAG
                InspectionFlag = null,
                ///SUM_WEIGHT
                SumWeight = null,
                ///SUM_VOLUME
                SumVolume = null,
                ///CUST_CODE
                CustCode = string.Empty,
                ///CUST_NAME
                CustName = string.Empty,
                ///ROUTE
                Route = string.Empty,
                ///ROUTE_NAME
                RouteName = string.Empty,
                ///PLAN_SHIPPING_TIME
                PlanShippingTime = null,
                ///INSPECTION_MODE
                InspectionMode = null,
                ///SUM_PACKAGE_QTY
                SumPackageQty = null
            };

            ///
            return(vmiReceiveInfo);
        }
コード例 #11
0
        /// <summary>
        /// GetReceiveCompleteDealSql
        /// </summary>
        /// <param name="vmiReceiveInfo"></param>
        /// <param name="vmiReceiveDetailInfos"></param>
        /// <param name="barcodeInfos"></param>
        /// <param name="loginUser"></param>
        /// <param name="emergencyFlag"></param>
        /// <returns></returns>
        public string GetReceiveCompleteDealSql(VmiReceiveInfo vmiReceiveInfo, List <VmiReceiveDetailInfo> vmiReceiveDetailInfos, List <BarcodeInfo> barcodeInfos, string loginUser)
        {
            ///获取系统配置
            Dictionary <string, string> configs = new ConfigDAL().GetValuesByCodes(new string[] {
                "VALID_VMI_RECEIVE_ACTUAL_QTY_EQUAL_SCANED_QTY_FLAG",
                "LES_TRAN_DATA_ENABLE_FLAG",
                "VMI_RECEIVE_MATERIAL_RECHECK_INSPECT_MODE",
                "INBOUND_SYNC_OUTBOUND_ENABLE_FLAG",
                "ENABLE_VMI_PACKAGE_MANAGEMENT_FLAG"
            });
            ///入库单客户端提交时处理语句
            ///WEB端为完成操作
            ///TODO:考虑增加是否支持单据多次收货的开关
            StringBuilder @string = new StringBuilder();

            ///更新入库单状态
            @string.AppendLine(GetReceiveStatusUpdateSql(vmiReceiveInfo.Id, WmmOrderStatusConstants.Completed, loginUser));
            ///
            foreach (VmiReceiveDetailInfo vmiReceiveDetailInfo in vmiReceiveDetailInfos)
            {
                List <BarcodeInfo> barcodes = barcodeInfos.Where(d => d.CreateSourceFid.GetValueOrDefault() == vmiReceiveDetailInfo.Fid.GetValueOrDefault()).ToList();
                if (barcodes.Count == 0)
                {
                    barcodes = barcodeInfos.Where(w => w.AsnRunsheetNo == vmiReceiveDetailInfo.TranNo &&
                                                  w.PartNo == vmiReceiveDetailInfo.PartNo &&
                                                  w.SupplierNum == vmiReceiveDetailInfo.SupplierNum &&
                                                  w.RunsheetNo == vmiReceiveDetailInfo.RunsheetNo).ToList();
                }

                ///是否校验VMI实收数量等于扫描数量
                configs.TryGetValue("VALID_VMI_RECEIVE_ACTUAL_QTY_EQUAL_SCANED_QTY_FLAG", out string valid_vmi_receive_actual_qty_equal_scaned_qty_flag);
                if (!string.IsNullOrEmpty(valid_vmi_receive_actual_qty_equal_scaned_qty_flag) && valid_vmi_receive_actual_qty_equal_scaned_qty_flag.ToLower() == "true")
                {
                    if (barcodes.Sum(d => d.CurrentQty.GetValueOrDefault()) != vmiReceiveDetailInfo.ActualQty.GetValueOrDefault())
                    {
                        throw new Exception("MC:0x00000258");///标签扫描数量与单据不一致
                    }
                    if (barcodes.Count != vmiReceiveDetailInfo.ActualBoxNum.GetValueOrDefault())
                    {
                        throw new Exception("MC:0x00000258");///标签扫描数量与单据不一致
                    }
                }

                ///入库单号、零件号、供应商、单号
                foreach (BarcodeInfo barcodeInfo in barcodes)
                {
                    ///来源不为空时获取来源
                    if (!string.IsNullOrEmpty(vmiReceiveDetailInfo.WmNo) && !string.IsNullOrEmpty(vmiReceiveDetailInfo.ZoneNo))
                    {
                        @string.AppendLine(BarcodeDAL.GetBarcodeUpdateSql(
                                               (int)BarcodeStatusConstants.Inbound,
                                               vmiReceiveDetailInfo.WmNo,
                                               vmiReceiveDetailInfo.ZoneNo,
                                               vmiReceiveDetailInfo.Dloc,
                                               vmiReceiveDetailInfo.TranNo,
                                               barcodeInfo.Fid.GetValueOrDefault(),
                                               loginUser));
                    }
                    else
                    {
                        @string.AppendLine(BarcodeDAL.GetBarcodeUpdateSql(
                                               (int)BarcodeStatusConstants.Inbound,
                                               vmiReceiveDetailInfo.TargetWm,
                                               vmiReceiveDetailInfo.TargetZone,
                                               vmiReceiveDetailInfo.TargetDloc,
                                               vmiReceiveDetailInfo.TranNo,
                                               barcodeInfo.Fid.GetValueOrDefault(),
                                               loginUser));
                    }
                }

                ///更新入库单明细信息
                @string.AppendLine(GetReceiveDetailActualQtyUpdateSql(
                                       vmiReceiveDetailInfo.Id,
                                       vmiReceiveDetailInfo.ActualBoxNum.GetValueOrDefault(),
                                       vmiReceiveDetailInfo.ActualQty.GetValueOrDefault(),
                                       loginUser));
            }
            ///转换为普通入库单进行处理
            List <ReceiveDetailInfo> receiveDetailInfos = ReceiveDetailBLL.GetReceiveDetailInfos(vmiReceiveDetailInfos);
            ReceiveInfo receiveInfo = ReceiveBLL.CreateReceiveInfo(loginUser);

            ReceiveBLL.GetReceiveInfo(vmiReceiveInfo, ref receiveInfo);
            ///是否启用LES交易记录创建
            configs.TryGetValue("LES_TRAN_DATA_ENABLE_FLAG", out string les_tran_data_enable_flag);
            if (!string.IsNullOrEmpty(les_tran_data_enable_flag) && les_tran_data_enable_flag.ToLower() == "true")
            {
                @string.AppendLine(ReceiveBLL.GetTranDetailsInsertSql(receiveInfo, receiveDetailInfos, (int)WmmTranTypeConstants.Inbound, loginUser));
            }

            ///系统配置中RECEIVE_MATERIAL_RECHECK_INSPECT_MODE入库免检物料重新校验检验模式标记,默认为true
            ///若该标记为true时将入库明细中的㊺免检物料比对检验模式基础数据中物料的当前检验模式
            ///若检验模式有变化则需要将变化的物料提交至QMIS检验任务中间表,并生成同步数据任务,否则忽略此逻辑(此项逻辑可以考虑异步实现)
            ///VMI入库免检物料重新校验检验模式标记
            configs.TryGetValue("VMI_RECEIVE_MATERIAL_RECHECK_INSPECT_MODE", out string vmi_receive_material_recheck_inspect_mode);
            if (!string.IsNullOrEmpty(vmi_receive_material_recheck_inspect_mode) && vmi_receive_material_recheck_inspect_mode.ToLower() == "true")
            {
                @string.AppendLine(PartInspectionModeBLL.ReloadInspectionMode(receiveInfo, ref receiveDetailInfos, loginUser));
            }

            ///将入库明细中是否产生出库单标记㊵为true的数据过滤出来,系统配置中SAME_ZONE_SAME_FINAL_ZONE_VALID_FLAG相同存储区相同中转存储区验证标记,
            ///默认为true,控制了同一张入库单的明细中不会出现不同的出库目标存储区㊷,
            ///所以此时只需直接根据入库单及明细复制出相应的出库单及明细,并以出库目标存储区㊷作为出库单的目标存储区入库实际数量⑱作为出库需求数量,
            ///若系统配置标记为false,则将过滤出来的入库明细数据根据其出库目标存储区进行分组,并按分组情况生成多个出库单,出库单状态为已发布WMM - 011
            ///入库后同步生成出库指令启用标记
            configs.TryGetValue("INBOUND_SYNC_OUTBOUND_ENABLE_FLAG", out string inboundSyncOutboundEnableFlag);
            if (!string.IsNullOrEmpty(inboundSyncOutboundEnableFlag) && inboundSyncOutboundEnableFlag.ToLower() == "true")
            {
                @string.AppendLine(OutputBLL.CreateOutputByReceiveSql(receiveInfo, receiveDetailInfos, barcodeInfos, loginUser));
            }

            ///系统配置ENABLE_PACKAGE_MANAGEMENT_FLAG是否启用器具管理标记,默认为true
            ///若该标记为ture时需要根据实收包装数量⑰以及包装型号⑲等数据产生器具包装随货入库交易数据PCM-002
            ///是否启用VMI器具管理标记
            configs.TryGetValue("ENABLE_VMI_PACKAGE_MANAGEMENT_FLAG", out string enablePackageManagementFlag);
            if (!string.IsNullOrEmpty(enablePackageManagementFlag) && enablePackageManagementFlag.ToLower() == "true")
            {
                @string.AppendLine(PackageTranDetailBLL.CreatePackageTranDetailsSql(receiveDetailInfos, loginUser));
            }

            return(@string.ToString());
        }