Ejemplo n.º 1
0
        protected override void DeleteDomainObjects(ArrayList domainObjects)
        {
            if (_InventoryFacade == null)
            {
                _InventoryFacade = new InventoryFacade(base.DataProvider);
            }
            WarehouseFacade _warehouseFacade = new WarehouseFacade(base.DataProvider);

            //this._InventoryFacade.DeleteASN(domainObjects.ToArray(typeof(ASN)) as ASN[]);
            this.DataProvider.BeginTransaction();
            try
            {
                this._InventoryFacade.DeleteASN1(domainObjects.ToArray(typeof(ASN)) as ASN[]);
                foreach (ASN asn in domainObjects.ToArray(typeof(ASN)) as ASN[])
                {
                    object[] objs_asnd = _InventoryFacade.GetASNDetailByStNo(asn.StNo);
                    if (objs_asnd != null)
                    {
                        foreach (ASNDetail asnd in objs_asnd)
                        {
                            _InventoryFacade.DeleteASNDetail(asnd);
                            object[] objs_item = _warehouseFacade.GetASNDetailItembyStnoAndStline(asnd.StNo, asnd.StLine);
                            if (objs_item != null)
                            {
                                foreach (Asndetailitem item in objs_item)
                                {
                                    _warehouseFacade.DeleteAsndetailitem(item);
                                }
                            }
                            object[] objs_sn = _warehouseFacade.GetASNDetailSNbyStnoandStline(asnd.StNo, asnd.StLine);
                            if (objs_sn != null)
                            {
                                foreach (Asndetailsn sn in objs_sn)
                                {
                                    _warehouseFacade.DeleteAsndetailsn(sn);
                                }
                            }
                        }
                    }
                }
                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public bool BindCarton2STLine(string Stline, string Stno, string cartonno, out string message)
        {
            message = string.Empty;
            InventoryFacade _InventoryFacade = new InventoryFacade(DataProvider);

            WarehouseFacade facade = new WarehouseFacade(DataProvider);
            int             result = _InventoryFacade.GetCartonNoByStnoAndCartonNo(Stno, cartonno);

            switch (result)
            {
            case 1:
            {
                message = "当前STNO 箱号重复";
                return(false);
            }

            case 2:
            {
                message = "此箱号在其他的入库指令号中";
                return(false);
            }

            case 3:
            {
                message = "此箱号在库存中";
                return(false);
            }
            }

            //判断箱号有没有跟其他入库单的行关联
            //

            ASNDetail asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(Stline), Stno);


            if (!string.IsNullOrEmpty(asnDetail.CartonNo))
            {
                message = "该行数据已有关联箱号:";
                return(false);
            }
            else
            {
                if (string.IsNullOrEmpty(cartonno))
                {
                    message = "箱号不能为空";
                    return(false);
                }
                ASN asn = (ASN)_InventoryFacade.GetASN(Stno);
                int num = _InventoryFacade.GetASNDetailCountCartonNoNutNull(Stno);
                if (num <= asn.InitRejectQty)
                {
                    message = "已经到拒收箱数,不用关联箱号";
                    return(false);
                }
                this.DataProvider.BeginTransaction();
                try
                {
                    asnDetail.CartonNo = cartonno.ToUpper();
                    _InventoryFacade.UpdateASNDetail(asnDetail);
                    object[] objs = facade.GetASNDetailSNbyStnoandStline((asnDetail as ASNDetail).StNo, (asnDetail as ASNDetail).StLine);
                    if (objs != null)
                    {
                        for (int i = 0; i < objs.Length; i++)
                        {
                            Asndetailsn a_sn = objs[i] as Asndetailsn;
                            a_sn.Cartonno = cartonno.ToUpper();
                            facade.UpdateAsndetailsn(a_sn);
                        }
                    }
                    this.DataProvider.CommitTransaction();
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    message = "关联失败";
                    return(false);
                }

                message = "关联箱号成功";
                return(true);
            }
        }