Exemplo n.º 1
0
        public IList<Hu> GetHuByPickTask(PickTask task)
        {
            IList<Hu> hus = new List<Hu>();

            IList<string> ph = this.genericMgr.FindAllWithNativeSql<string>("select RepackHu from ord_PickHu where PickId = ? ", task.PickId);
            if (ph != null && ph.Count > 0)
            {
                //已经生成过
                hus = huMgr.LoadHus(ph);
            }
            else
            {
                //第一次
                hus = huMgr.CreateHu(task, string.Empty);
                if (hus != null && hus.Count > 0)
                {
                    foreach (Hu h in hus)
                    {
                        PickHu newPh = new PickHu();
                        newPh.PickId = task.PickId;
                        newPh.RepackHu = h.HuId;

                        this.genericMgr.Create(newPh);
                    }
                }
            }

            return hus;
        }
Exemplo n.º 2
0
        public void CancelPickResult(PickResult result)
        {
            //查询拣货任务关联的拣货结果,取消拣货(删除拣货结果明细),更新累计拣货数(订单单位)
            //,恢复已经删除的配送条码PickHu,释放已占用的库存。
            //禁止取消AsnNo有值的拣货结果
            if (!result.IsShip)
            {
                PickTask task = this.genericMgr.FindAll<PickTask>("from PickTask where PickId = ? ", result.PickId).SingleOrDefault();
                if (task == null)
                {
                    throw new BusinessException("找不到拣货任务");
                }

                //恢复配送条码
                PickHu oldPickedHu = new PickHu();
                oldPickedHu.PickId = result.PickId;
                oldPickedHu.RepackHu = result.PickedHu;
                this.genericMgr.Create(oldPickedHu);

                //释放已占用库存
                locationDetailMgr.CancelInventoryOccupy(CodeMaster.OccupyType.Pick, result.ResultId);

                //更新累计数
                task.PickedQty -= result.PickedQty;
                this.genericMgr.Update(task);

                //删除result
                this.genericMgr.Delete(result);
            }
            else
            {
                throw new BusinessException("拣货条码已经发货,不能取消");
            }
        }