Ejemplo n.º 1
0
        /// <summary>
        /// 更新拣货任务单
        /// </summary>
        /// <param name="baseDataPickTask">最后结果集</param>
        /// <returns></returns>
        public BasePutData <PickTask> PutPickTask(PickTask pickTask)
        {
            PickTask task = new PickTask
            {
                id         = pickTask.id,
                BillStatus = pickTask.BillStatus,
                version    = pickTask.version
            };

            if (pickTask.BillStatus == DocumentStatus.异常.ToString() && pickTask.AbnormalCauses != "")
            {
                task.AbnormalCauses = pickTask.AbnormalCauses;
            }

            //当任务单状态为已完成时,携带完成时间进行更新
            if (pickTask.BillStatus == DocumentStatus.已完成.ToString())
            {
                task.FinishDate = GetDateTimeNow();
            }

            BasePutData <PickTask> basePutData = HttpHelper.GetInstance().Put(task);

            if (basePutData.code != 0)
            {
                LogUtils.Error("PutPickTask " + basePutData.message);
            }

            return(basePutData);
        }
        public ReturnGoodsDetail(PickTask task)
        {
            InitializeComponent();

            pickTask = task;
            //操作人
            operatorName.Content = ApplicationState.GetUserInfo().name;
            //工单号
            orderNum.Content = task.name;

            Timer iniTimer = new Timer(100);

            iniTimer.AutoReset = false;
            iniTimer.Enabled   = true;
            iniTimer.Elapsed  += new ElapsedEventHandler(onInitData);
        }
        public ReturnGoodsClose(PickTask task, HashSet <CommodityEps> hs)
        {
            InitializeComponent();

            pickTask = task;
            //操作人
            operatorName.Content = ApplicationState.GetUserInfo().name;
            ////工单号
            orderNum.Content = task.name;
            time.Content     = DateTime.Now.ToString("yyyy年MM月dd日");
            after            = hs;

            Timer iniTimer = new Timer(100);

            iniTimer.AutoReset = false;
            iniTimer.Enabled   = true;
            iniTimer.Elapsed  += new ElapsedEventHandler(onInitData);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据拣货任务单获取所有货柜下的商品详情
        /// </summary>
        /// <param name="pickTask"></param>
        /// <returns></returns>
        public BaseData <PickCommodity> GetPickTaskAllCommodityDetail(PickTask pickTask)
        {
            BaseData <PickCommodity> baseDataPickTaskCommodityDetail = HttpHelper.GetInstance().Get <PickCommodity>(new QueryParam
            {
                view_filter =
                {
                    filter                =
                    {
                        logical_relation = "1",
                        expressions      =
                        {
                            new QueryParam.Expressions
                            {
                                field     = "PickTaskId",
                                @operator = "==",
                                operands  = { $"'{ HttpUtility.UrlEncode(pickTask.id) }'" }
                            }
                        }
                    }
                }
            });

            return(baseDataPickTaskCommodityDetail);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 拣货的库存变化
        /// </summary>
        /// <param name="baseDatacommodityCode"></param>
        /// <param name="pickTask"></param>
        /// <param name="bAutoSubmit">是否是主动提交</param>
        /// <returns></returns>
        public BasePostData <CommodityInventoryChange> CreatePickTaskCommodityInventoryChange(BaseData <CommodityCode> baseDataCommodityCode, PickTask pickTask, bool bAutoSubmit)
        {
            BasePostData <CommodityInventoryChange> retBaseSinglePostDataCommodityInventoryChange = null;

            //校验是否含有数据,如果含有数据,有就继续下一步
            baseDataCommodityCode = HttpHelper.GetInstance().ResultCheck(baseDataCommodityCode, out bool isSuccess);

            if (isSuccess)
            {
                var CommodityCodes = baseDataCommodityCode.body.objects;

                var CommodityInventoryChanges = new List <CommodityInventoryChange>(CommodityCodes.Count);

                CommodityCodes.ForEach(it => {
                    CommodityInventoryChange cic = new CommodityInventoryChange()
                    {
                        CommodityCodeId = it.id,           //商品码【扫描】
                        SourceBill      = new SourceBill() //来源单据
                        {
                            object_name = typeof(PickTask).Name,
                            object_id   = pickTask.id
                        }
                    };

                    if (it.operate_type == (int)OperateType.出库)
                    {
                        cic.ChangeStatus = CommodityInventoryChangeStatus.拣货作业.ToString();
                        cic.StoreHouseId = it.StoreHouseId;
                    }
                    else
                    {
                        cic.ChangeStatus    = CommodityInventoryChangeStatus.正常.ToString();
                        cic.EquipmentId     = it.EquipmentId;
                        cic.StoreHouseId    = it.StoreHouseId;
                        cic.GoodsLocationId = it.GoodsLocationId;
                    }

                    if (!bAutoSubmit && it.AbnormalDisplay == AbnormalDisplay.异常.ToString())
                    {
                        cic.AdjustStatus = CommodityInventoryChangeAdjustStatus.是.ToString();
                    }

                    CommodityInventoryChanges.Add(cic);
                });

                retBaseSinglePostDataCommodityInventoryChange = CommodityInventoryChangeBll.GetInstance().CreateCommodityInventoryChange(CommodityInventoryChanges);
            }
            else
            {
                retBaseSinglePostDataCommodityInventoryChange = new BasePostData <CommodityInventoryChange>
                {
                    code    = baseDataCommodityCode.code,
                    message = baseDataCommodityCode.message
                };
            }

            return(retBaseSinglePostDataCommodityInventoryChange);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取变化后的拣货单
        /// </summary>
        /// <param name="baseDatacommodityCode"></param>
        /// <param name="pickTask"></param>
        /// <param name="baseDataPickTaskCommodityDetail"></param>
        /// <returns></returns>
        public void GetPickTaskChange(BaseData <CommodityCode> baseDatacommodityCode, PickTask pickTask, BaseData <PickCommodity> baseDataPickTaskCommodityDetail)
        {
            HttpHelper.GetInstance().ResultCheck(baseDataPickTaskCommodityDetail, out bool isSuccess);

            HttpHelper.GetInstance().ResultCheck(baseDatacommodityCode, out bool isSuccess1);

            if (isSuccess && isSuccess1)
            {
                var pickTaskCommodityDetails = baseDataPickTaskCommodityDetail.body.objects.Where(item => item.Number != item.PickNumber);

                var sfdCommodityIds = pickTaskCommodityDetails.Select(it => it.CommodityId).Distinct().ToList();

                //WARING 这种取法的的前提是pickTaskCommodityDetails中全是一个货柜的产品,前面获取数据的做法是错误的,没有将货位id加进去,
                //在后续多柜中改正
                var goodsLocationId = pickTaskCommodityDetails.First().GoodsLocationId;

                var commodityCodes = new List <CommodityCode>();

                commodityCodes = baseDatacommodityCode.body.objects;

                commodityCodes.ForEach(it => {
                    if (it.operate_type == (int)OperateType.入库)
                    {
                        it.AbnormalDisplay = AbnormalDisplay.异常.ToString();
                    }
                    else
                    {
                        if (sfdCommodityIds.Contains(it.CommodityId))
                        {
                            var pickTaskCommodityDetail = pickTaskCommodityDetails.Where(item => item.CommodityId == it.CommodityId).First();

                            if ((pickTaskCommodityDetail.Number - pickTaskCommodityDetail.PickNumber) >= ++pickTaskCommodityDetail.CountPickNumber)
                            {
                                it.AbnormalDisplay = AbnormalDisplay.正常.ToString();
                            }
                            else
                            {
                                it.AbnormalDisplay = AbnormalDisplay.异常.ToString();
                            }
                        }
                        else
                        {
                            it.AbnormalDisplay = AbnormalDisplay.异常.ToString();
                        }
                    }
                });

                var cccIds = commodityCodes.Select(it => it.CommodityId).Distinct().ToList();

                //是否名称全部一致
                bool isAllContains = sfdCommodityIds.All(cccIds.Contains) && sfdCommodityIds.Count == cccIds.Count;

                if (isAllContains)
                {
                    bool isAllNormal = true;
                    bool isAllSame   = true;

                    foreach (PickCommodity stcd in pickTaskCommodityDetails)
                    {
                        if ((stcd.Number - stcd.PickNumber) < commodityCodes.Where(cit => cit.CommodityId == stcd.CommodityId).Count())
                        {
                            //有商品的上架数量超出规定数量
                            isAllNormal = false;
                            break;
                        }

                        if ((stcd.Number - stcd.PickNumber) != commodityCodes.Where(cit => cit.CommodityId == stcd.CommodityId).Count())
                        {
                            //有商品的上架数量和规定数量不一致
                            isAllSame = false;
                        }
                    }

                    if (isAllNormal)
                    {
                        if (isAllSame)
                        {
                            //获取这个任务单中所有的商品详情
                            BaseData <PickCommodity> bdAllpc = GetPickTaskAllCommodityDetail(pickTask);

                            HttpHelper.GetInstance().ResultCheck(bdAllpc, out bool isSuccess2);

                            if (isSuccess2)
                            {
                                //只有所有商品都完成了拣货,不管在那个货架上,才能将这个任务单的状态改为“已完成”
                                if (bdAllpc.body.objects.Where(it => it.Number != it.PickNumber && it.GoodsLocationId != goodsLocationId).Count() == 0)
                                {
                                    pickTask.BillStatus = DocumentStatus.已完成.ToString();
                                }
                                else
                                {
                                    pickTask.BillStatus = DocumentStatus.进行中.ToString();
                                }
                            }
                            else
                            {
                                LogUtils.Error("GetPickTaskChange: GetShelfTaskAllCommodityDetail" + bdAllpc.message);
                            }
                        }
                        else
                        {
                            pickTask.BillStatus = DocumentStatus.进行中.ToString();
                        }
                    }
                    else
                    {
                        pickTask.BillStatus = DocumentStatus.异常.ToString();
                    }
                }
                else
                {
                    pickTask.BillStatus = DocumentStatus.异常.ToString();
                }

                foreach (PickCommodity stcd in pickTaskCommodityDetails)
                {
                    stcd.CurPickNumber  = commodityCodes.Where(cit => cit.CommodityId == stcd.CommodityId).Count();
                    stcd.PlanPickNumber = stcd.Number - stcd.PickNumber;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据拣货单号获取商品详情
        /// </summary>
        /// <param name="pickTaskName"></param>
        /// <returns></returns>
        public BaseData <PickCommodity> GetPickTaskCommodityDetail(PickTask pickTask)
        {
            BaseData <PickCommodity> baseDataPickTaskCommodityDetail = HttpHelper.GetInstance().Get <PickCommodity>(new QueryParam
            {
                view_filter =
                {
                    filter                =
                    {
                        logical_relation = "1 AND 2",
                        expressions      =
                        {
                            new QueryParam.Expressions
                            {
                                field     = "PickTaskId",
                                @operator = "==",
                                operands  = { $"'{ HttpUtility.UrlEncode(pickTask.id) }'"                                    }
                            },
                            new QueryParam.Expressions
                            {
                                field     = "EquipmentId",
                                @operator = "==",
                                operands  = { $"'{ HttpUtility.UrlEncode(ApplicationState.GetValue<string>((int)ApplicationKey.EquipId)) }'" }
                            }
                        }
                    }
                }
            });

            //校验是否含有数据,如果含有数据,拼接具体字段
            HttpHelper.GetInstance().ResultCheck(baseDataPickTaskCommodityDetail, out bool isSuccess);

            if (isSuccess)
            {
                baseDataPickTaskCommodityDetail.body.objects.ForEach(it =>
                {
                    //拼接设备名字
                    if (!string.IsNullOrEmpty(it.EquipmentId))
                    {
                        it.EquipmentName = GetNameById <Equipment>(it.EquipmentId);
                    }

                    //拼接库房名字
                    if (!string.IsNullOrEmpty(it.StoreHouseId))
                    {
                        it.StoreHouseName = GetNameById <StoreHouse>(it.StoreHouseId);
                    }

                    //拼接货位名字
                    if (!string.IsNullOrEmpty(it.GoodsLocationId))
                    {
                        it.GoodsLocationName = GetNameById <GoodsLocation>(it.GoodsLocationId);
                    }

                    //拼接商品名字
                    if (!string.IsNullOrEmpty(it.CommodityId))
                    {
                        it.CommodityName = GetNameById <Commodity>(it.CommodityId);
                    }
                });
            }

            return(baseDataPickTaskCommodityDetail);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 确认开柜
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onEnterDetailOpen(object sender, RoutedEventArgs e)
        {
            PickTask pickTask = (PickTask)((Button)sender).Tag;

            EnterReturnGoodsDetailOpenEvent(this, pickTask);
        }