Пример #1
0
        /// <summary>
        /// Jis拉动
        /// </summary>
        /// <param name="jisPartBoxInfo"></param>
        /// <param name="jisCounterInfo"></param>
        /// <param name="jisCounterLogs"></param>
        /// <param name="maintainInhouseLogistics"></param>
        /// <param name="JisPullGuid"></param>
        /// <param name="orderCode"></param>
        /// <param name="pullOrdersInfos"></param>
        /// <param name="isJis"></param>
        /// <returns></returns>
        public string JisPull(JisPartBoxInfo jisPartBoxInfo, JisCounterInfo jisCounterInfo, List <JisCounterLogInfo> jisCounterLogs, List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogistics, List <PullOrdersInfo> pullOrdersInfos, bool isJis)
        {
            StringBuilder stringBuilder = new StringBuilder();
            ///拉动单Guid
            Guid JisPullGuid = Guid.NewGuid();
            ///拉动单号
            string orderCode = new SeqDefineBLL().GetCurrentCode("JIS_PULL_ORDER_CODE");
            ///单据衔接
            MaterialPullingOrderInfo materialPullingOrderInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderInfo();

            ///jisPartBoxInfo -> MaterialPullingOrderInfo
            MaterialPullingCommonBLL.GetJisMaterialPullingOrderInfo(jisPartBoxInfo, ref materialPullingOrderInfo);
            ///orderCode -> MaterialPullingOrderInfo
            MaterialPullingCommonBLL.GetorderCodeMaterialPullingOrderInfo(orderCode, ref materialPullingOrderInfo);
            foreach (JisCounterLogInfo jisCounterLog in jisCounterLogs)
            {
                ///物料拉动信息
                MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo = maintainInhouseLogistics.Where(d => d.PartNo == jisCounterLog.PartNo).FirstOrDefault();
                if (maintainInhouseLogisticStandardInfo == null)
                {
                    continue;
                }
                ///生产订单信息
                PullOrdersInfo pullOrdersInfo = pullOrdersInfos.FirstOrDefault(d => d.OrderNo == jisCounterLog.SourceData);
                if (pullOrdersInfo == null)
                {
                    continue;
                }
                ///仓储衔接明细表
                MaterialPullingOrderDetailInfo detailInfo = MaterialPullingCommonBLL.CreateMaterialPullingOrderDetailInfo();
                ///maintainInhouseLogisticStandardInfo -> MaterialPullingOrderDetailInfo
                MaterialPullingCommonBLL.GetMainMaterialPullingOrderDetailInfo(maintainInhouseLogisticStandardInfo, jisCounterLog.PartQty.GetValueOrDefault(), ref detailInfo);
                ///jisPartBoxInfo-> MaterialPullingOrderDetailInfo
                MaterialPullingCommonBLL.GetJisMaterialPullingOrderDetailInfo(jisPartBoxInfo, ref detailInfo);
                ///orderCode-> MaterialPullingOrderDetailInfo
                MaterialPullingCommonBLL.GetOrderCodeMaterialPullingOrderDetailInfo(orderCode, ref detailInfo);
                ///pullOrdersInfo-> MaterialPullingOrderDetailInfo
                MaterialPullingCommonBLL.GetPullOrderMaterialPullingOrderDetailInfo(pullOrdersInfo, ref detailInfo);
                ///Add
                materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Add(detailInfo);
                if (isJis)
                {
                    ///排序拉动明细
                    stringBuilder.AppendFormat(CreateJisPullOrderDetailSql(JisPullGuid, materialPullingOrderInfo.MaterialPullingOrderDetailInfos));
                }
                else
                {
                    ///物料成套拉动明细
                    stringBuilder.AppendFormat(CreateCompletePullOrderDetailSql(JisPullGuid, materialPullingOrderInfo.MaterialPullingOrderDetailInfos));
                }
                if (stringBuilder.Length == 0)
                {
                    continue;
                }
            }
            if (isJis)
            {
                ///开始车号
                materialPullingOrderInfo.StartVehicheNo = materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Min(d => d.DayVehicheSeqNo.GetValueOrDefault());
                ///结束车号
                materialPullingOrderInfo.EndVehicheNo = materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Max(d => d.DayVehicheSeqNo.GetValueOrDefault());
                ///排序拉动主表
                stringBuilder.AppendFormat(CreateJisPullOrderSql(JisPullGuid, materialPullingOrderInfo));
            }
            else
            {
                ///车辆编号
                materialPullingOrderInfo.VehicheModelNo = materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Select(d => d.VehicheModelNo).FirstOrDefault();
                ///生产订单号
                materialPullingOrderInfo.OrderNo = materialPullingOrderInfo.MaterialPullingOrderDetailInfos.Select(d => d.OrderNo).FirstOrDefault();
                ///物料成套拉动主表
                stringBuilder.AppendFormat(CreateCompletePullOrderSql(JisPullGuid, materialPullingOrderInfo));
            }
            ///仓储衔接
            stringBuilder.AppendFormat(MaterialPullingCommonBLL.Handler(materialPullingOrderInfo, loginUser));
            return(stringBuilder.ToString());
        }