Ejemplo n.º 1
0
        protected override void DeleteDomainObjects(ArrayList domainObjects)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new WarehouseFacade(base.DataProvider);
            }
            if (_InventoryFacade == null)
            {
                _InventoryFacade = new InventoryFacade(this.DataProvider);
            }
            CARTONINVDETAILSN[] cartoninvdetailsnList = ((CARTONINVDETAILSN[])domainObjects.ToArray(typeof(CARTONINVDETAILSN)));
            try
            {
                this.DataProvider.BeginTransaction();
                foreach (CARTONINVDETAILSN cartoninvdetailsn in cartoninvdetailsnList)
                {
                    //1、删除完SN后,同时删除掉对应的TBLCARTONINVDETAILMATERIAL,TBLCARTONINVDETAIL信息。
                    //2、拣货任务令头状态为pick,且发货箱单头状态为Release时才可以删除。
                    #region delete
                    _WarehouseFacade.DELETECARTONINVDETAILSN(cartoninvdetailsn);
                    Pick       pickHead   = _InventoryFacade.GetPick(cartoninvdetailsn.PICKNO) as Pick;
                    PickDetail pickDetail = _InventoryFacade.GetPickDetail(cartoninvdetailsn.PICKNO, cartoninvdetailsn.PICKLINE) as PickDetail;
                    //Pickdetailmaterial pickdetailmaterial = _WarehouseFacade.GetPickdetailmaterial(cartonInvDetailMaterial.PICKNO, cartonInvDetailMaterial.CARTONNO) as Pickdetailmaterial;
                    if (pickDetail == null || pickHead == null)
                    {
                        this.DataProvider.RollbackTransaction();
                        return;
                    }
                    object[] objPickdetailmaterials = this._WarehouseFacade.QueryPICKDetailMaterialBydqMCode(cartoninvdetailsn.PICKNO, pickDetail.DQMCode);
                    if (objPickdetailmaterials == null)
                    {
                        this.DataProvider.RollbackTransaction();
                        return;
                    }
                    CARTONINVOICES cartoninvoices = _WarehouseFacade.GetCartoninvoices(cartoninvdetailsn.CARINVNO)
                                                    as CARTONINVOICES;
                    if (cartoninvoices == null)
                    {
                        this.DataProvider.RollbackTransaction();
                        return;
                    }
                    //if (!(cartoninvoices.STATUS == PickDetail_STATUS.Status_Release))
                    //{
                    //    this.DataProvider.RollbackTransaction();
                    //    WebInfoPublish.Publish(this, "发货箱单头状态为Release时才可以删除", this.languageComponent1);
                    //    return;
                    //}
                    if (!(pickHead.Status == PickHeadStatus.PickHeadStatus_Pick || pickHead.Status == PickHeadStatus.PickHeadStatus_WaitPick))
                    {
                        this.DataProvider.RollbackTransaction();
                        WebInfoPublish.Publish(this, "拣货任务令头状态为pick或者待拣料时才可以删除", this.languageComponent1);
                        return;
                    }
                    object[] cartoninvdetailSnList = _WarehouseFacade.GetCartoninvdetailsnByCartonno(cartoninvdetailsn.CARINVNO,
                                                                                                     cartoninvdetailsn.CARTONNO);
                    if (cartoninvdetailSnList == null)
                    {
                        CartonInvDetailMaterial cartonInvDetailMaterial = _WarehouseFacade.QueryCartonInvDetailMaterial(cartoninvdetailsn.CARINVNO,
                                                                                                                        cartoninvdetailsn.CARTONNO, pickDetail.DQMCode) as CartonInvDetailMaterial;
                        _WarehouseFacade.DeleteCartonInvDetailMaterial(cartonInvDetailMaterial);
                        _WarehouseFacade.DeleteCartoninvdetailByCartonNo(cartoninvdetailsn.CARINVNO, cartoninvdetailsn.CARTONNO);
                    }
                    else
                    {
                        CartonInvDetailMaterial cartonInvDetailMaterial = _WarehouseFacade.QueryCartonInvDetailMaterial(cartoninvdetailsn.CARINVNO,
                                                                                                                        cartoninvdetailsn.CARTONNO, pickDetail.DQMCode) as CartonInvDetailMaterial;
                        if (cartonInvDetailMaterial != null)
                        {
                            cartonInvDetailMaterial.QTY -= 1;
                            _WarehouseFacade.UpdateCartonInvDetailMaterial(cartonInvDetailMaterial);
                        }
                    }

                    pickDetail.PQTY -= 1;
                    _InventoryFacade.UpdatePickDetail(pickDetail);

                    #region Pickdetailmaterial
                    foreach (Pickdetailmaterial _pickdetailmaterial in objPickdetailmaterials)
                    {
                        decimal num = _pickdetailmaterial.PQty;
                        if (num > 0)
                        {
                            _pickdetailmaterial.PQty -= 1;
                            this._WarehouseFacade.UpdatePickdetailmaterial(_pickdetailmaterial);
                            break;
                        }
                    }
                    #endregion
                    //pickdetailmaterial.PQty-= 1;
                    //_WarehouseFacade.UpdatePickdetailmaterial(pickdetailmaterial);

                    #endregion
                }
                this.DataProvider.CommitTransaction();
                WebInfoPublish.Publish(this, "删除成功", this.languageComponent1);
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1);
            }
        }
Ejemplo n.º 2
0
        private void ToSTS(string oqcNo)
        {
            if (_OQCFacade == null)
            {
                _OQCFacade = new OQCFacade(base.DataProvider);
            }
            _InventoryFacade = new InventoryFacade(base.DataProvider);
            WarehouseFacade _WarehouseFacade = new WarehouseFacade(base.DataProvider);

            //1、更新OQC单表(TBLOQC)
            _OQCFacade.UpdateOQC(OQCType.OQCType_ExemptCheck, OQCStatus.OQCStatus_OQCClose, "Y", oqcNo);

            //2、更新OQC单明细表(TBLOQCDETAIL)
            _OQCFacade.UpdateOQCDetail("Y", oqcNo);

            //3、更新OQC单明细SN信息表(TBLOQCDETAILSN)
            _OQCFacade.UpdateOQCDetailSN("Y", oqcNo);

            //4、更新发货箱单头信息表(TBLCartonInvoices)
            Pick pick = (Pick)_InventoryFacade.GetPickByOqcNo(oqcNo);

            if (pick != null)
            {
                //if (pick.GFFlag == "X")
                //{
                //    if (CheckAllOQCStatusIsOQCClose(oqcNo))
                //    {
                //        CARTONINVOICES cartonInvoices = (CARTONINVOICES)_WarehouseFacade.GetCartoninvoicesByOqcNo(oqcNo);
                //        if (cartonInvoices != null)
                //        {
                //            cartonInvoices.STATUS = CartonInvoices_STATUS.Status_OQCClose;
                //            _WarehouseFacade.UpdateCartoninvoices(cartonInvoices);
                //        }
                //    }
                //    else
                //    {
                //        throw new Exception("OQC单号" + oqcNo + "没有全部检验完成");
                //    }
                //}
                //else
                //{


                if (_OQCFacade.IsOQCFinish(pick.PickNo))
                {
                    pick.Status = PickHeadStatus.PickHeadStatus_PackingListing;
                    _WarehouseFacade.UpdatePick(pick);
                }
                CARTONINVOICES cartonInvoices = (CARTONINVOICES)_WarehouseFacade.GetCartoninvoicesByOqcNo(oqcNo);
                if (cartonInvoices != null)
                {
                    cartonInvoices.STATUS = CartonInvoices_STATUS.Status_OQCClose;
                    _WarehouseFacade.UpdateCartoninvoices(cartonInvoices);
                }

                //}

                #region 在invinouttrans表中增加一条数据
                WarehouseFacade facade  = new WarehouseFacade(base.DataProvider);
                DBDateTime      dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider);

                InvInOutTrans trans1 = facade.CreateNewInvInOutTrans();
                trans1.CartonNO        = string.Empty;
                trans1.DqMCode         = string.Empty;
                trans1.FacCode         = string.Empty;
                trans1.FromFacCode     = string.Empty;
                trans1.FromStorageCode = string.Empty;
                trans1.InvNO           = pick.InvNo;//.InvNo;
                trans1.InvType         = pick.PickType;
                trans1.LotNo           = string.Empty;
                trans1.MaintainDate    = dbTime1.DBDate;
                trans1.MaintainTime    = dbTime1.DBTime;
                trans1.MaintainUser    = this.GetUserCode();
                trans1.MCode           = string.Empty;
                trans1.ProductionDate  = 0;
                trans1.Qty             = 0;
                trans1.Serial          = 0;
                trans1.StorageAgeDate  = 0;
                trans1.StorageCode     = string.Empty;
                trans1.SupplierLotNo   = string.Empty;
                trans1.TransNO         = pick.PickNo;// asnIqc.IqcNo;
                trans1.TransType       = "OUT";
                trans1.Unit            = string.Empty;
                trans1.ProcessType     = "OQC";
                facade.AddInvInOutTrans(trans1);


                Domain.OQC.OQC asnIqcHead     = (Domain.OQC.OQC)_OQCFacade.GetOQC(oqcNo);
                object[]       objs_oqcDetail = _OQCFacade.GetOQCDetailByOqcNo(oqcNo);
                if (objs_oqcDetail != null)
                {
                    foreach (OQCDetail asnIqc in objs_oqcDetail)
                    {
                        InvInOutTrans trans = facade.CreateNewInvInOutTrans();
                        trans.CartonNO        = string.Empty;
                        trans.DqMCode         = asnIqc.DQMCode;
                        trans.FacCode         = string.Empty;
                        trans.FromFacCode     = string.Empty;
                        trans.FromStorageCode = string.Empty;
                        trans.InvNO           = asnIqc.CarInvNo;//.InvNo;
                        trans.InvType         = asnIqcHead.OqcType;
                        trans.LotNo           = string.Empty;
                        trans.MaintainDate    = dbTime1.DBDate;
                        trans.MaintainTime    = dbTime1.DBTime;
                        trans.MaintainUser    = this.GetUserCode();
                        trans.MCode           = asnIqc.MCode;
                        trans.ProductionDate  = 0;
                        trans.Qty             = asnIqc.Qty;
                        trans.Serial          = 0;
                        trans.StorageAgeDate  = 0;
                        trans.StorageCode     = string.Empty;
                        trans.SupplierLotNo   = string.Empty;
                        trans.TransNO         = oqcNo;// asnIqc.IqcNo;
                        trans.TransType       = "OUT";
                        trans.Unit            = string.Empty;
                        trans.ProcessType     = "OQC";
                        facade.AddInvInOutTrans(trans);
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 3
0
        protected void CmdConfirmOweQtyObjects(object[] pickList)
        {
            // 点击该按钮,初始TBLPICKDETAIL. OweQTY为空or零,
            //点击该按钮后保存TBLPICKDETAIL. OweQTY= TBLPICKDETAIL. SQTY
            //注:只有状态为:Owe:欠料的物料行可以执行此按钮,确认后该行更新状态为ClosePick:拣料完成
            if (facade == null)
            {
                facade = new InventoryFacade(base.DataProvider);
            }
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new WarehouseFacade(base.DataProvider);
            }
            DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            try
            {
                this.DataProvider.BeginTransaction();
                foreach (PickDetail pickdetail in pickList)
                {
                    if (pickdetail.Status == PickDetail_STATUS.Status_Owe)
                    {
                        if (pickdetail.OweQTY == 0 || string.IsNullOrEmpty(pickdetail.OweQTY.ToString()))
                        {
                            PickDetail oldpickdetail = (PickDetail)facade.GetPickDetail(pickdetail.PickNo, pickdetail.PickLine);
                            oldpickdetail.OweQTY = oldpickdetail.SQTY;
                            oldpickdetail.Status = PickDetail_STATUS.Status_ClosePick;
                            facade.UpdatePickDetail(oldpickdetail);
                        }
                        else
                        {
                            WebInfoPublish.Publish(this, "已申请欠料发货!", this.languageComponent1);
                            return;
                        }
                    }
                    else
                    {
                        WebInfoPublish.Publish(this, "只有状态为欠料的物料行可以执行此按钮", this.languageComponent1);
                        return;
                    }
                }

                #region 在invinouttrans表中增加一条数据 箱单完成日期
                WarehouseFacade wfacade = new WarehouseFacade(base.DataProvider);
                DBDateTime      dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider);
                foreach (PickDetail pickDetail in pickList)
                {
                    Pick          pick  = facade.GetPick(pickDetail.PickNo) as Pick;
                    InvInOutTrans trans = wfacade.CreateNewInvInOutTrans();
                    trans.CartonNO        = string.Empty;
                    trans.DqMCode         = pickDetail.DQMCode;
                    trans.FacCode         = string.Empty;
                    trans.FromFacCode     = string.Empty;
                    trans.FromStorageCode = string.Empty;
                    trans.InvNO           = pick.InvNo;//.InvNo;
                    trans.InvType         = pick.PickType;
                    trans.LotNo           = string.Empty;
                    trans.MaintainDate    = dbTime1.DBDate;
                    trans.MaintainTime    = dbTime1.DBTime;
                    trans.MaintainUser    = this.GetUserCode();
                    trans.MCode           = pickDetail.MCode;
                    trans.ProductionDate  = 0;
                    trans.Qty             = pickDetail.QTY;
                    trans.Serial          = 0;
                    trans.StorageAgeDate  = 0;
                    trans.StorageCode     = string.Empty;
                    trans.SupplierLotNo   = string.Empty;
                    trans.TransNO         = pickDetail.PickNo;
                    trans.TransType       = "OUT";
                    trans.Unit            = string.Empty;
                    trans.ProcessType     = "ClosePick";
                    wfacade.AddInvInOutTrans(trans);
                }

                #endregion

                string pickno       = FormatHelper.CleanString(this.txtPickNoQuery.Text);
                bool   isUpdatePick = facade.QueryPickDetailCount(pickno, PickDetail_STATUS.Status_ClosePick) == 0;
                if (isUpdatePick)
                {
                    facade.UpdatePickStatusByPickno(pickno, PickHeadStatus.PickHeadStatus_MakePackingList);
                }
                #region  创建发货箱单

                string carInvNo = string.Empty;
                object obj      = _WarehouseFacade.GetCartonInvoices(pickno);
                if (obj == null)
                {
                    CARTONINVOICES CartonH = _WarehouseFacade.CreateNewCartoninvoices();
                    object         objLot  = _WarehouseFacade.GetNewLotNO("K", dbTime.DBDate.ToString().Substring(2, 6).ToString());
                    Serialbook     serbook = _WarehouseFacade.CreateNewSerialbook();
                    if (objLot == null)
                    {
                        #region
                        CartonH.CARINVNO = "K" + dbTime.DBDate.ToString().Substring(2, 6).ToString() + "001";
                        CartonH.PICKNO   = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPickNoQuery.Text));
                        CartonH.STATUS   = CartonInvoices_STATUS.Status_Release;
                        CartonH.CDATE    = dbTime.DBDate;
                        CartonH.CTIME    = dbTime.DBTime;
                        CartonH.CUSER    = this.GetUserCode();
                        CartonH.MDATE    = dbTime.DBDate;
                        CartonH.MTIME    = dbTime.DBTime;
                        CartonH.MUSER    = this.GetUserCode();
                        _WarehouseFacade.AddCartoninvoices(CartonH);

                        serbook.SNprefix  = "K" + dbTime.DBDate.ToString().Substring(2, 6).ToString();
                        serbook.MAXSerial = "2";
                        serbook.MUser     = this.GetUserCode();
                        serbook.MDate     = dbTime.DBDate;
                        serbook.MTime     = dbTime.DBTime;

                        _WarehouseFacade.AddSerialbook(serbook);
                        #endregion
                    }
                    else
                    {
                        #region
                        string MAXNO = (objLot as Serialbook).MAXSerial;
                        string SNNO  = (objLot as Serialbook).SNprefix;
                        CartonH.CARINVNO = SNNO + Convert.ToString(MAXNO).PadLeft(3, '0');
                        CartonH.PICKNO   = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPickNoQuery.Text));
                        CartonH.STATUS   = CartonInvoices_STATUS.Status_Release;
                        CartonH.CDATE    = dbTime.DBDate;
                        CartonH.CTIME    = dbTime.DBTime;
                        CartonH.CUSER    = this.GetUserCode();
                        CartonH.MDATE    = dbTime.DBDate;
                        CartonH.MTIME    = dbTime.DBTime;
                        CartonH.MUSER    = this.GetUserCode();
                        _WarehouseFacade.AddCartoninvoices(CartonH);

                        //更新tblserialbook
                        serbook.SNprefix  = SNNO;
                        serbook.MAXSerial = Convert.ToString((int.Parse(MAXNO) + 1));
                        serbook.MUser     = this.GetUserCode();
                        serbook.MDate     = dbTime.DBDate;
                        serbook.MTime     = dbTime.DBTime;
                        _WarehouseFacade.UpdateSerialbook(serbook);
                        #endregion
                    }
                }
                # endregion
                this.DataProvider.CommitTransaction();
                WebInfoPublish.Publish(this, "确认欠料发货数量成功", this.languageComponent1);
            }