/// <summary> /// 同步 /// </summary> /// <param name="loginUser"></param> public static void Sync(string loginUser) { ///获取没有处理的送货单数据 List <SrmDeliveryNoteInfo> srmDeliveryNoteInfos = new SrmDeliveryNoteBLL().GetList("[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty); if (srmDeliveryNoteInfos.Count == 0) { return; } ///获取没有处理的送货单详情数据- 没有数据主表报错 List <SrmDeliveryNoteDetailInfo> srmDeliveryNoteDetailInfos = new SrmDeliveryNoteDetailBLL().GetList("[ORDER_FID] in ('" + string.Join("','", srmDeliveryNoteInfos.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "')", string.Empty); if (srmDeliveryNoteDetailInfos.Count == 0) { return; } ///获取相关物料供应商信息 List <SupplierInfo> supplierInfos = new SupplierBLL().GetList("" + "[SUPPLIER_NUM] in ('" + string.Join("','", srmDeliveryNoteInfos.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_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000475' where " +///送货单中供应商信息无效 "[ID] in (" + string.Join(",", srmDeliveryNoteInfos.Select(d => d.Id).ToArray()) + ");"); BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString()); return; } ///获取相关存储区信息 List <string> zoneNos = srmDeliveryNoteInfos.Where(d => !string.IsNullOrEmpty(d.Targetzoneno)).Select(d => d.Targetzoneno).ToList(); zoneNos.AddRange(srmDeliveryNoteInfos.Where(d => !string.IsNullOrEmpty(d.Sourcezoneno)).Select(d => d.Sourcezoneno).ToList()); List <ZonesInfo> zonesInfos = new ZonesBLL().GetList("" + "[ZONE_NO] in ('" + string.Join("','", zoneNos.ToArray()) + "') and " + "[PLANT] in ('" + string.Join("','", srmDeliveryNoteInfos.Select(d => d.Plant).ToArray()) + "')", string.Empty); if (zonesInfos.Count == 0) { @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000485' where " +///送货单中存储区信息不存在 "[ID] in (" + string.Join(",", srmDeliveryNoteInfos.Select(d => d.Id).ToArray()) + ");"); BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString()); return; } /// List <long> dealedIds = new List <long>(); ///循环写入数据 foreach (SrmDeliveryNoteInfo srmDeliveryNoteInfo in srmDeliveryNoteInfos) { ///获取送货单明细 List <SrmDeliveryNoteDetailInfo> srmDeliveryNoteDetails = srmDeliveryNoteDetailInfos.Where(d => d.OrderFid.GetValueOrDefault() == srmDeliveryNoteInfo.Fid.GetValueOrDefault()).ToList(); if (srmDeliveryNoteDetails.Count == 0) { @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000473' where " +///送货单无物料明细 "[ID] = " + srmDeliveryNoteInfo.Id + ";"); continue; } ///供应商信息 SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == srmDeliveryNoteInfo.Suppliercode); if (supplierInfo == null) { @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000484' where " +///该送货单中供应商信息不存在 "[ID] = " + srmDeliveryNoteInfo.Id + ";"); continue; } ///校验供应商是否启用了ASN功能 if (!supplierInfo.AsnFlag.GetValueOrDefault()) { @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000486' where " +///该供应商未启用ASN功能 "[ID] = " + srmDeliveryNoteInfo.Id + ";"); continue; } ///目标存储区 ZonesInfo zonesInfo = zonesInfos.FirstOrDefault(d => d.ZoneNo == srmDeliveryNoteInfo.Targetzoneno && d.Plant == srmDeliveryNoteInfo.Plant); if (zonesInfo == null) { @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] set " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," + "[PROCESS_TIME] = GETDATE()," + "[COMMENTS] = N'0x00000246' where " +///存储区数据错误 "[ID] = " + srmDeliveryNoteInfo.Id + ";"); continue; } ///单据衔接对象创建 MaterialPullingOrderInfo materialPullingOrderInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo(); ///SrmDeliveryNoteInfo -> MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(srmDeliveryNoteInfo, ref materialPullingOrderInfo); ///SupplierInfo -> MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(supplierInfo, ref materialPullingOrderInfo); /// materialPullingOrderInfo.TargetWmNo = zonesInfo.WmNo; ///PART_BOX_CODE,TODO:考虑由SRM增加字段? materialPullingOrderInfo.PartBoxCode = string.Empty; ///PART_BOX_NAME,11 materialPullingOrderInfo.PartBoxName = string.Empty; /// materialPullingOrderInfo.Route = null; /// foreach (SrmDeliveryNoteDetailInfo srmDeliveryNoteDetail in srmDeliveryNoteDetails) { ///单据衔接明细对象创建 MaterialPullingOrderDetailInfo materialPullingOrderDetailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo(); ///SrmDeliveryNoteDetailInfo -> MaterialPullingOrderDetailInfo MaterialPullingCommonBLL.GetMaterialPullingOrderDetailInfo(srmDeliveryNoteDetail, ref materialPullingOrderDetailInfo); ///SRM拉动单明细中的供应商必须为单据的供应商 materialPullingOrderDetailInfo.SupplierNum = srmDeliveryNoteInfo.Suppliercode; /// materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Add(materialPullingOrderDetailInfo); } ///生成创建入库单的语句 @string.Append(MaterialPullingCommonBLL.CreateReceiveSql(materialPullingOrderInfo, new List <PartsStockInfo>(), loginUser)); ///执行成功的ID dealedIds.Add(srmDeliveryNoteInfo.Id); } if (dealedIds.Count > 0) { ///已处理的中间表数据更新为已处理状态 @string.AppendLine("update [LES].[TI_IFM_SRM_DELIVERY_NOTE] 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(); } }
/// <summary> /// 生成拉动单 /// </summary> /// <param name="twdPartBoxInfo"></param> /// <param name="twdWindowTimeInfo"></param> /// <param name="supplierInfo"></param> /// <param name="twdCounterInfos"></param> /// <param name="maintainInhouseLogisticStandardInfos"></param> /// <returns></returns> private string CreateTwdPullOrder(List <TwdCounterInfo> twdCounterInfos, TwdPartBoxInfo twdPartBoxInfo, List <SupplierInfo> supplierInfos, TwdWindowTimeInfo twdWindowTimeInfo, List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogisticStandardInfos) { /// StringBuilder @string = new StringBuilder(); ///Create TwdPullOrderInfo TwdPullOrderInfo twdPullOrderInfo = null; ///Create PcsPullOrderInfo PcsPullOrderInfo pcsPullOrderInfo = null; ///仓储衔接主表 MaterialPullingOrderInfo materialPulling = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo(); if (twdPartBoxInfo.TwdPullMode.GetValueOrDefault() == (int)TwdPullModeConstants.Pcs) { pcsPullOrderInfo = PcsPullOrderBLL.CreatePcsPullOrderInfo(loginUser); ///TwdWindowTimeInfo -> PcsPullOrderInfo PcsPullOrderBLL.GetPcsPullOrderInfo(twdWindowTimeInfo, ref pcsPullOrderInfo); ///TwdPartBoxInfo -> PcsPullOrderInfo PcsPullOrderBLL.GetPcsPullOrderInfo(twdPartBoxInfo, ref pcsPullOrderInfo); ///SupplierInfo -> PcsPullOrderInfo SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == twdPartBoxInfo.SupplierNum); PcsPullOrderBLL.GetPcsPullOrderInfo(supplierInfo, ref pcsPullOrderInfo); /// @string.AppendLine(PcsPullOrderDAL.GetInsertSql(pcsPullOrderInfo)); ///PcsPullOrderInfo -> MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(pcsPullOrderInfo, ref materialPulling); } else { twdPullOrderInfo = TwdPullOrderBLL.CreateTwdPullOrderInfo(loginUser); ///TwdWindowTimeInfo -> TwdPullOrderInfo TwdPullOrderBLL.GetTwdPullOrderInfo(twdWindowTimeInfo, ref twdPullOrderInfo); ///TwdPartBoxInfo -> TwdPullOrderInfo TwdPullOrderBLL.GetTwdPullOrderInfo(twdPartBoxInfo, ref twdPullOrderInfo); ///SupplierInfo -> TwdPullOrderInfo SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == twdPartBoxInfo.SupplierNum); TwdPullOrderBLL.GetTwdPullOrderInfo(supplierInfo, ref twdPullOrderInfo); /// @string.AppendLine(TwdPullOrderDAL.GetInsertSql(twdPullOrderInfo)); ///TwdPullOrderInfo -> MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(twdPullOrderInfo, ref materialPulling); } ///行号 int rowNo = 0; ///循环计数器 foreach (TwdCounterInfo twdCounterInfo in twdCounterInfos) { ///物料需求数量 decimal requiredPartQty = 0; ///物料需求箱数 int packageQty = 0; #region 圆整方式 ///向上圆整 if (twdCounterInfo.RoundnessMode == (int)RoundnessModeConstants.Upward) { if (twdCounterInfo.Package.GetValueOrDefault() > 0) { ///根据计数器中的圆整方式⑨,当圆整方式⑨为20.向上时以Math.Ceiling(当前计数⑮/箱内数量⑯)*箱内数量⑯作为本次的物料需求数量 requiredPartQty = Math.Ceiling(twdCounterInfo.CurrentQty.GetValueOrDefault() / twdCounterInfo.Package.GetValueOrDefault()) * twdCounterInfo.Package.GetValueOrDefault(); packageQty = Convert.ToInt32(Math.Ceiling(requiredPartQty / twdCounterInfo.Package.GetValueOrDefault())); } } ///向下圆整 if (twdCounterInfo.RoundnessMode == (int)RoundnessModeConstants.Downward) { if (twdCounterInfo.Package.GetValueOrDefault() > 0) { ///根据计数器中的圆整方式⑨,当圆整方式⑨为20.向上时以Math.Ceiling(当前计数⑮/箱内数量⑯)*箱内数量⑯作为本次的物料需求数量 requiredPartQty = Math.Floor(twdCounterInfo.CurrentQty.GetValueOrDefault() / twdCounterInfo.Package.GetValueOrDefault()) * twdCounterInfo.Package.GetValueOrDefault(); packageQty = Convert.ToInt32(Math.Ceiling(requiredPartQty / twdCounterInfo.Package.GetValueOrDefault())); } } ///按需求数量 if (twdCounterInfo.RoundnessMode == (int)RoundnessModeConstants.Ondemand) { ///当圆整方式⑨为按需时则当前计数⑮直接作为本次的物料需求数量 requiredPartQty = twdCounterInfo.CurrentQty.GetValueOrDefault(); packageQty = Convert.ToInt32(Math.Ceiling(requiredPartQty / twdCounterInfo.Package.GetValueOrDefault())); } #endregion ///获取物料拉动信息 MaintainInhouseLogisticStandardInfo logisticStandardInfo = maintainInhouseLogisticStandardInfos.FirstOrDefault(d => d.Fid == twdCounterInfo.PartPullFid.GetValueOrDefault()); if (logisticStandardInfo == null) { continue; } ///若计数器对应的物料拉动信息中最小起订包装数为一个大于零的数字,则需要在此处比对物料需求箱数是否大于等于最小起订包装数,若不满足则不产生拉动 if (logisticStandardInfo.MinPullBox.GetValueOrDefault() > 0 && packageQty < logisticStandardInfo.MinPullBox.GetValueOrDefault()) { continue; } ///若计数器对应的物料拉动信息中批量包装数为一个大于零的数字,则需要Math.Floor(物料需求箱数 / 批量包装数) * 批量包装数,作为新的物料需求箱数,同时* 箱内数量⑯获得新的物料需求数量 if (logisticStandardInfo.BatchPullBox.GetValueOrDefault() > 0 && twdCounterInfo.Package.GetValueOrDefault() > 0) { packageQty = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(packageQty) / logisticStandardInfo.BatchPullBox.GetValueOrDefault())) * logisticStandardInfo.BatchPullBox.GetValueOrDefault(); requiredPartQty = packageQty * twdCounterInfo.Package.GetValueOrDefault(); } ///仓储衔接明细表 MaterialPullingOrderDetailInfo detailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo(); if (twdPartBoxInfo.TwdPullMode.GetValueOrDefault() == (int)TwdPullModeConstants.Pcs) { /// PcsPullOrderDetailInfo pullOrderDetailInfo = PcsPullOrderDetailBLL.CreatePcsPullOrderDetailInfo(loginUser); ///MaintainInhouseLogisticStandardInfo -> TwdPullOrderDetailInfo PcsPullOrderDetailBLL.GetPcsPullOrderDetailInfo(logisticStandardInfo, ref pullOrderDetailInfo); ///TwdPullOrderInfo -> TwdPullOrderDetailInfo PcsPullOrderDetailBLL.GetPcsPullOrderDetailInfo(pcsPullOrderInfo, ref pullOrderDetailInfo); ///ROW_NO,行号 pullOrderDetailInfo.RowNo = ++rowNo; ///REQUIRED_PACKAGE_QTY,需求包装数 pullOrderDetailInfo.RequiredPackageQty = packageQty; ///REQUIRED_PART_QTY,需求物料数量 pullOrderDetailInfo.RequiredPartQty = requiredPartQty; /// @string.AppendLine(PcsPullOrderDetailDAL.GetInsertSql(pullOrderDetailInfo)); ///TwdPullOrderDetailInfo -> MaterialPullingOrderDetailInfo MaterialPullingCommonBLL.GetMaterialPullingOrderDetailInfo(pullOrderDetailInfo, ref detailInfo); } else { /// TwdPullOrderDetailInfo pullOrderDetailInfo = TwdPullOrderDetailBLL.CreateTwdPullOrderDetailInfo(loginUser); ///MaintainInhouseLogisticStandardInfo -> TwdPullOrderDetailInfo TwdPullOrderDetailBLL.GetTwdPullOrderDetailInfo(logisticStandardInfo, ref pullOrderDetailInfo); ///TwdPullOrderInfo -> TwdPullOrderDetailInfo TwdPullOrderDetailBLL.GetTwdPullOrderDetailInfo(twdPullOrderInfo, ref pullOrderDetailInfo); ///ROW_NO,行号 pullOrderDetailInfo.RowNo = ++rowNo; ///REQUIRED_PACKAGE_QTY,需求包装数 pullOrderDetailInfo.RequiredPackageQty = packageQty; ///REQUIRED_PART_QTY,需求物料数量 pullOrderDetailInfo.RequiredPartQty = requiredPartQty; /// @string.AppendLine(TwdPullOrderDetailDAL.GetInsertSql(pullOrderDetailInfo)); ///TwdPullOrderDetailInfo -> MaterialPullingOrderDetailInfo MaterialPullingCommonBLL.GetMaterialPullingOrderDetailInfo(pullOrderDetailInfo, ref detailInfo); } /// materialPulling.MaterialPullingOrderDetailInfos.Add(detailInfo); #region 扣减计数器 ///最后根据物料需求数量扣减对应的计数器的当前计数⑮ @string.AppendLine("update [LES].[TT_MPM_TWD_COUNTER] " + "set [CURRENT_QTY] = isnull([CURRENT_QTY],0) - " + requiredPartQty + "," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "' " + "where [ID]= " + twdCounterInfo.Id + ";"); /// TwdCounterLogInfo twdCounterLogInfo = TwdCounterLogBLL.CreateTwdCounterLogInfo(twdCounterInfo.Fid.GetValueOrDefault(), loginUser); ///TwdCounterInfo -> TwdCounterLogInfo TwdCounterLogBLL.GetTwdCounterLogInfo(twdCounterInfo, ref twdCounterLogInfo); ///PART_QTY,物料数量 twdCounterLogInfo.PartQty = 0 - requiredPartQty; ///SOURCE_DATA,目视来源数据 twdCounterLogInfo.SourceData = twdPullOrderInfo.OrderCode; ///SOURCE_DATA_FID,数据来源外键 twdCounterLogInfo.SourceDataFid = twdPullOrderInfo.Fid; ///SOURCE_DATA_TYPE,数据来源类型 twdCounterLogInfo.SourceDataType = (int)TwdCounterSourceDataTypeConstants.CreateRunsheet; /// @string.AppendLine(TwdCounterLogDAL.GetInsertSql(twdCounterLogInfo)); #endregion } ///更新时间窗窗口时间为已发单状态 @string.AppendLine("update [LES].[TT_MPM_TWD_WINDOW_TIME] " + "set [SEND_TIME_STATUS]= " + (int)SendTimeStatusConstants.Sent + "," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "' " + "where [ID]= " + twdWindowTimeInfo.Id + ";"); ///拉动单生成后需要调用拉动仓储衔接函数获取语句 @string.AppendLine(MaterialPullingCommonBLL.Handler(materialPulling, loginUser)); return(@string.ToString()); }
/// <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(); } }
/// <summary> /// 对于MPM-036逻辑进行函数封装 /// </summary> /// <param name="emergencyPullingCartInfos"></param> /// <param name="loginUser"></param> public static string Handler(List <EmergencyPullingCartInfo> emergencyPullingCartInfos, string loginUser) { ///执行语句 StringBuilder @string = new StringBuilder(); ///获取系统配置是否允许过量提前拉动 string allowedFlag = new ConfigDAL().GetValueByCode("ENABLE_EXCEED_COUNTER_QTY_WHEN_ADVANCE_PULL"); ///接收紧急拉动购物车对象集合进行处理 if (emergencyPullingCartInfos.Count == 0) { throw new Exception("MC:0x00000084");///数据错误 } ///对应的物料拉动信息 List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogisticStandardInfos = new MaintainInhouseLogisticStandardBLL().GetList("" + " and [STATUS] =" + (int)BasicDataStatusConstants.Enable + "" + " and [FID] in ('" + string.Join("','", emergencyPullingCartInfos.Select(d => d.LogisticStandardFid).ToArray()) + "')", string.Empty); if (maintainInhouseLogisticStandardInfos.Count == 0) { throw new Exception("MC:0x00000213");///物料拉动信息数据错误 } ///首先需要将其按照拉动方式、零件类进行分组,每个分组产生一张紧急拉动单 var cartGroups = emergencyPullingCartInfos.GroupBy(d => new { d.PullMode, d.PartBoxCode }).ToList(); #region 手工拉动 PLAN var planCartGroups = cartGroups.Where(d => d.Key.PullMode == (int)PullModeConstants.Plan).ToList(); ///计划拉动零件类 List <PlanPartBoxInfo> planPartBoxInfos = new PlanPartBoxBLL().GetList("" + " and [STATUS] = " + (int)BasicDataStatusConstants.Enable + "" + " and [PART_BOX_CODE] in ('" + string.Join("','", planCartGroups.Select(d => d.Key.PartBoxCode).ToArray()) + "')", string.Empty); foreach (var planCartGroup in planCartGroups) { ///从参数集合从提取对应的紧急拉动购物车集合 List <EmergencyPullingCartInfo> pullingCartInfos = emergencyPullingCartInfos.Where(d => d.PullMode == planCartGroup.Key.PullMode && d.PartBoxCode == planCartGroup.Key.PartBoxCode).ToList(); if (pullingCartInfos.Count == 0) { continue; } ///计划零件类 PlanPartBoxInfo planPartBoxInfo = planPartBoxInfos.FirstOrDefault(d => d.PartBoxCode == planCartGroup.Key.PartBoxCode); if (planPartBoxInfo == null) { continue; } ///计划拉动-->仓储衔接主表 MaterialPullingOrderInfo materialPulling = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo(); ///计划拉动单主表 PlanPullOrderInfo planPullOrderInfo = PlanPullOrderBLL.CreatePlanPullOrder(loginUser); ///OrderType 拉动单类型 planPullOrderInfo.OrderType = (int)PullOrderTypeConstants.Emergency; ///PlanPartBoxInfo-->PlanPullOrderInfo PlanPullOrderBLL.GetPlanPullOrder(planPartBoxInfo, ref planPullOrderInfo); ///计划拉动单主表sql @string.AppendLine(PlanPullOrderDAL.GetInsertSql(planPullOrderInfo)); ///PlanPullOrderInfo -> MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPlanPullingOrderInfo(planPullOrderInfo, ref materialPulling); foreach (EmergencyPullingCartInfo planCartInfo in pullingCartInfos) { ///物料拉动信息 MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo = maintainInhouseLogisticStandardInfos.FirstOrDefault(d => d.Fid == planCartInfo.LogisticStandardFid); if (maintainInhouseLogisticStandardInfo == null) { continue; } ///物料包装数量在此需要根据单包装数量以及物料需求数量进行向上圆整计算 ///REQUIRED_BOX_QTY:物料包装数量 PULL_PACKAGE_QTY:单包装数量 REQUIRED_PART_QTY:物料需求数量 if (planCartInfo.PullPackageQty.GetValueOrDefault() == 0) { continue; ///O不能做被除数 } planCartInfo.RequiredBoxQty = Convert.ToInt32(Math.Ceiling(planCartInfo.RequiredPartQty.GetValueOrDefault() / planCartInfo.PullPackageQty.GetValueOrDefault())); ///仓储衔接明细表 MaterialPullingOrderDetailInfo detailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo(); ///计划拉动单明细 PlanPullOrderDetailInfo planPullOrderDetailInfo = PlanPullOrderDetailBLL.CreatePlanPullOrderDetail(loginUser); ///MaintainInhouseLogisticStandardInfo -> PlanPullOrderDetailInfo PlanPullOrderDetailBLL.GetPlanPullOrderDetail(maintainInhouseLogisticStandardInfo, ref planPullOrderDetailInfo); ///TwdPullOrderInfo -> TwdPullOrderDetailInfo PlanPullOrderDetailBLL.GetPlanPullOrderDetailInfo(planPullOrderInfo, ref planPullOrderDetailInfo); ///RequiredPackageQty planPullOrderDetailInfo.RequiredPackageQty = planCartInfo.RequiredBoxQty.GetValueOrDefault(); ///RequiredPartQty planPullOrderDetailInfo.RequiredPartQty = planCartInfo.RequiredPartQty.GetValueOrDefault(); ///计划拉动明细sql @string.AppendLine(PlanPullOrderDetailDAL.GetInsertSql(planPullOrderDetailInfo)); ///PlanPullOrderDetailInfo -> MaterialPullingOrderDetailInfo MaterialPullingCommonBLL.GetMaterialPullingOrderDetail(planPullOrderDetailInfo, ref detailInfo); ///仓储明细集合Add materialPulling.MaterialPullingOrderDetailInfos.Add(detailInfo); } ///拉动单生成后需要调用拉动仓储衔接函数获取语句 @string.AppendLine(MaterialPullingCommonBLL.Handler(materialPulling, loginUser)); } #endregion #region 提前拉动 TWD var twdCartGroups = cartGroups.Where(d => d.Key.PullMode == (int)PullModeConstants.Pcs || d.Key.PullMode == (int)PullModeConstants.Twd).ToList(); ///TWD计数器 List <TwdCounterInfo> twdCounterInfos = new TwdCounterBLL().GetList("" + "[STATUS] =" + (int)BasicDataStatusConstants.Enable + " and " + "[PART_PULL_FID] in ('" + string.Join("','", maintainInhouseLogisticStandardInfos.Select(d => d.Fid).ToArray()) + "') and " + "isnull([CURRENT_QTY],0) > 0", string.Empty); ///TWD零件类 List <TwdPartBoxInfo> twdPartBoxInfos = new TwdPartBoxBLL().GetList("" + "[STATUS] =" + (int)BasicDataStatusConstants.Enable + " and " + "[PART_BOX_CODE] in ('" + string.Join("','", twdCartGroups.Select(d => d.Key.PartBoxCode).ToArray()) + "')", string.Empty); foreach (var twdCartGroup in twdCartGroups) { ///从参数集合从提取对应的紧急拉动购物车集合 List <EmergencyPullingCartInfo> pullingCartInfos = emergencyPullingCartInfos.Where(d => d.PullMode == twdCartGroup.Key.PullMode && d.PartBoxCode == twdCartGroup.Key.PartBoxCode).ToList(); if (pullingCartInfos.Count == 0) { continue; } ///TWD零件类 TwdPartBoxInfo twdPartBoxInfo = twdPartBoxInfos.FirstOrDefault(d => d.PartBoxCode == twdCartGroup.Key.PartBoxCode); if (twdPartBoxInfo == null) { continue; } ///触发层级拉动的集合 List <EmergencyPullingCartInfo> pullingLevelCartInfos = pullingCartInfos.Where(d => d.TriggerPullFlag == true).ToList(); foreach (EmergencyPullingCartInfo pullingLevelCartInfo in pullingLevelCartInfos) { ///需要根据其物料拉动信息外键获取对应的计数器数据(状态必须为已启用) TwdCounterInfo twdCounterInfo = twdCounterInfos.FirstOrDefault(d => d.PartPullFid == pullingLevelCartInfo.LogisticStandardFid.GetValueOrDefault() && d.Status == (int)BasicDataStatusConstants.Enable); if (twdCounterInfo == null) { continue; } ///在此之前需要根据物料图号、供应商、层级仓库、层级存储区在物料拉动信息中获取匹配的目标仓库、目标存储区数据 MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo = maintainInhouseLogisticStandardInfos.FirstOrDefault(d => d.PartNo == pullingLevelCartInfo.PartNo && d.SupplierNum == pullingLevelCartInfo.SupplierNum && d.WmNo == pullingLevelCartInfo.TriggerWmNo && d.ZoneNo == pullingLevelCartInfo.TriggerZoneNo); ///触发层级拉动 @string.AppendFormat(TwdCounterBLL.LevelPullCounter(maintainInhouseLogisticStandardInfo, pullingLevelCartInfo.RequiredPartQty.GetValueOrDefault(), loginUser, twdCounterInfo.Fid.GetValueOrDefault(), twdPartBoxInfo)); } ///提前拉动的集合 List <EmergencyPullingCartInfo> advancePullCartInfos = pullingCartInfos.Where(d => d.TriggerPullFlag == false && d.EmergencyPullMode == (int)EmergencyPullModeConstants.AdvancePull).ToList(); if (advancePullCartInfos.Count == 0) { continue; } ///仓储衔接主表 MaterialPullingOrderInfo materialPulling = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo(); ///TWD拉动单主表 TwdPullOrderInfo twdPullOrderInfo = TwdPullOrderBLL.CreateTwdPullOrderInfo(loginUser); ///TwdPartBoxInfo -> TwdPullOrderInfo TwdPullOrderBLL.GetTwdPullOrderInfo(twdPartBoxInfo, ref twdPullOrderInfo); ///TWD拉动单主表sql @string.AppendLine(TwdPullOrderDAL.GetInsertSql(twdPullOrderInfo)); ///TwdPullOrderInfo-->MaterialPullingOrderInfo MaterialPullingCommonBLL.GetMaterialPullingOrderInfo(twdPullOrderInfo, ref materialPulling); int rowNo = 0; ///行号 ///逐条循环每个购物车 foreach (EmergencyPullingCartInfo advancePullCartInfo in advancePullCartInfos) { ///需要根据其物料拉动信息外键获取对应的计数器数据(状态必须为已启用) ///TT_MPM_TWD_COUNTER TWD计数器 TwdCounterInfo twdCounterInfo = twdCounterInfos.FirstOrDefault(d => d.PartPullFid == advancePullCartInfo.LogisticStandardFid.GetValueOrDefault() && d.Status == (int)BasicDataStatusConstants.Enable); if (twdCounterInfo == null) { continue; } ///物料拉动信息 MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo = maintainInhouseLogisticStandardInfos.FirstOrDefault(d => d.Fid == advancePullCartInfo.LogisticStandardFid); if (maintainInhouseLogisticStandardInfo == null) { continue; } ///物料包装数量在此需要根据单包装数量以及物料需求数量进行向上圆整计算 ///REQUIRED_BOX_QTY:物料包装数量 PULL_PACKAGE_QTY:单包装数量 REQUIRED_PART_QTY:物料需求数量 if (advancePullCartInfo.PullPackageQty.GetValueOrDefault() == 0) { continue; ///O不能做被除数 } advancePullCartInfo.RequiredBoxQty = Convert.ToInt32(Math.Ceiling(advancePullCartInfo.RequiredPartQty.GetValueOrDefault() / advancePullCartInfo.PullPackageQty.GetValueOrDefault())); ///若该系统配置标记为false时、计数器当前累计数量不允许小于购物车物料需求数量, if (allowedFlag.ToLower() == "false" && twdCounterInfo.CurrentQty.GetValueOrDefault() < advancePullCartInfo.RequiredPartQty.GetValueOrDefault()) { continue; } ///仓储衔接明细表 MaterialPullingOrderDetailInfo detailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo(); ///TWD明细表 TwdPullOrderDetailInfo pullOrderDetailInfo = TwdPullOrderDetailBLL.CreateTwdPullOrderDetailInfo(loginUser); ///MaintainInhouseLogisticStandardInfo -> TwdPullOrderDetailInfo TwdPullOrderDetailBLL.GetTwdPullOrderDetailInfo(maintainInhouseLogisticStandardInfo, ref pullOrderDetailInfo); ///TwdPullOrderInfo -> TwdPullOrderDetailInfo TwdPullOrderDetailBLL.GetTwdPullOrderDetailInfo(twdPullOrderInfo, ref pullOrderDetailInfo); ///ROW_NO,行号 pullOrderDetailInfo.RowNo = ++rowNo; ///REQUIRED_PACKAGE_QTY,需求包装数 pullOrderDetailInfo.RequiredPackageQty = advancePullCartInfo.RequiredBoxQty.GetValueOrDefault(); ///REQUIRED_PART_QTY,需求物料数量 pullOrderDetailInfo.RequiredPartQty = advancePullCartInfo.RequiredPartQty.GetValueOrDefault(); ///TWD明细表sql @string.AppendLine(TwdPullOrderDetailDAL.GetInsertSql(pullOrderDetailInfo)); ///TwdPullOrderDetailInfo -> MaterialPullingOrderDetailInfo MaterialPullingCommonBLL.GetMaterialPullingOrderDetailInfo(pullOrderDetailInfo, ref detailInfo); ///仓储衔接集合Add materialPulling.MaterialPullingOrderDetailInfos.Add(detailInfo); ///否则直接对计数器的当前累计数量按购物车物料需求数量进行扣减 @string.AppendLine("update [LES].[TT_MPM_TWD_COUNTER] " + "set [CURRENT_QTY] = isnull([CURRENT_QTY],0) - " + advancePullCartInfo.RequiredPartQty.GetValueOrDefault() + "," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "' " + "where [ID]= " + twdCounterInfo.Id + ";"); ///同时记录计数器日志并标记其类型为提前拉动 TwdCounterLogInfo twdCounterLogInfo = TwdCounterLogBLL.CreateTwdCounterLogInfo(twdCounterInfo.Fid.GetValueOrDefault(), loginUser); ///TwdCounterInfo -> TwdCounterLogInfo TwdCounterLogBLL.GetTwdCounterLogInfo(twdCounterInfo, ref twdCounterLogInfo); ///PART_QTY,物料数量 twdCounterLogInfo.PartQty = 0 - advancePullCartInfo.RequiredPartQty.GetValueOrDefault(); ///SOURCE_DATA,目视来源数据 twdCounterLogInfo.SourceData = twdPullOrderInfo.OrderCode; ///SOURCE_DATA_FID,数据来源外键 twdCounterLogInfo.SourceDataFid = twdPullOrderInfo.Fid; ///SOURCE_DATA_TYPE,数据来源类型 twdCounterLogInfo.SourceDataType = (int)TwdCounterSourceDataTypeConstants.AdvancePull; ///计数器日志sql @string.AppendLine(TwdCounterLogDAL.GetInsertSql(twdCounterLogInfo)); } ///拉动单生成后需要调用拉动仓储衔接函数获取语句 @string.AppendLine(MaterialPullingCommonBLL.Handler(materialPulling, loginUser)); } #endregion return(@string.ToString()); }