Exemple #1
0
        public string Commit_Click(string userCode, string statusList, string transNo, string tLocationCode, string fromCarton, string tcarton, string inputsn, string inputqty)
        {
            string msg;

            #region facade

            InventoryFacade facade = new InventoryFacade(this.DataProvider);
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new WarehouseFacade(this.DataProvider);
            }
            ItemFacade itemFacade = new ItemFacade();
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
            #endregion

            #region check
            if (string.IsNullOrEmpty(transNo))
            {
                msg = "移转单号不能为空";
                return(msg);
            }
            StorageDetail storageCarton = (StorageDetail)facade.GetStorageDetail(fromCarton);
            if (storageCarton == null)
            {  //A 根据原箱号和数量操作。根据原箱号(cartonno)到TBLStorageDetail中查找数据。没有报错。
                msg = "转储单中没有对应的原箱号";
                return(msg);
            }

            if (string.IsNullOrEmpty(tLocationCode))
            {
                msg = "目标货位不能为空";
                return(msg);
            }
            if (string.IsNullOrEmpty(tcarton))
            {
                msg = "目标箱号不能为空";
                return(msg);
            }

            Storloctrans storloctrans = (Storloctrans)_WarehouseFacade.GetStorloctrans(transNo);
            if (storloctrans == null)
            {
                msg = "移转单号不存在";
                return(msg);
            }
            #endregion
            string msgsn = "";


            StorageDetail fromStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(fromCarton);
            StorageDetail toStorageDetail   = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton);
            if (fromStorageDetail == null)
            {
                return("原箱号在库存中不存在!");
            }
            StorloctransDetail storloctransdetailObj = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode);
            if (storloctransdetailObj == null)
            {
                return("转储单中没有对应的物料号");
            }

            Location tLocation = (Location)facade.GetLocation(tLocationCode, 1);
            if (fromStorageDetail.StorageCode != tLocation.StorageCode)
            {
                return("原货位的库位必须与目标货位的库位一致!");
            }
            if (toStorageDetail != null && toStorageDetail.StorageCode != fromStorageDetail.StorageCode)
            {
                return("目标箱号的库位必须原箱号的库位一样!");
            }

            if (tcarton != fromCarton && toStorageDetail != null && toStorageDetail.LocationCode != tLocation.LocationCode)
            {
                return("目标箱号的货位必须与填写的目标货位一致!");
            }

            if (toStorageDetail != null && toStorageDetail.DQMCode != fromStorageDetail.DQMCode)
            {
                return("目标箱号的物料必须与原箱号的物料一致!");
            }
            if ((statusList == CartonType.CartonType_SplitCarton) && (tcarton == fromCarton))
            {
                return("拆箱必须原箱号和目标箱号不同!");
            }
            try
            {
                this.DataProvider.BeginTransaction();


                InvInOutTrans trans = _WarehouseFacade.CreateNewInvInOutTrans();
                trans.CartonNO        = tcarton;
                trans.DqMCode         = fromStorageDetail.DQMCode;
                trans.FacCode         = fromStorageDetail.FacCode;
                trans.FromFacCode     = fromStorageDetail.FacCode;
                trans.FromStorageCode = fromStorageDetail.StorageCode;
                trans.InvNO           = " ";
                trans.InvType         = " ";
                trans.LotNo           = " ";
                trans.MaintainDate    = dbDateTime.DBDate;
                trans.MaintainTime    = dbDateTime.DBTime;
                trans.MaintainUser    = userCode;
                trans.MCode           = fromStorageDetail.MCode;
                trans.ProductionDate  = fromStorageDetail.ProductionDate;
                trans.Qty             = fromStorageDetail.StorageQty;
                trans.Serial          = 0;
                trans.StorageAgeDate  = fromStorageDetail.StorageAgeDate;
                trans.StorageCode     = fromStorageDetail.StorageCode;
                trans.SupplierLotNo   = fromStorageDetail.SupplierLotNo;
                trans.TransNO         = transNo;
                trans.TransType       = "IN";
                trans.ProcessType     = "LocationTrans";
                trans.Unit            = fromStorageDetail.Unit;
                _WarehouseFacade.AddInvInOutTrans(trans);


                #region【整箱】:
                if (statusList == CartonType.CartonType_AllCarton)
                {
                    msgsn = "箱号:" + fromCarton;

                    if (fromStorageDetail.FreezeQty > 0)
                    {
                        return("此箱号以被占用不能移动");
                    }

                    if (_WarehouseFacade.GetStorageDetailSNPickBlockCount(fromCarton) > 0)
                    {
                        return("此箱号SN已被被占用不能移动");
                    }
                    if (_WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton,
                                                                     tcarton) != null)
                    {
                        return(transNo + "此单下已存在" + fromCarton + "移动到" + tcarton + ",请另行创建单据!");
                    }


                    facade.DeleteStorageDetail(fromStorageDetail);
                    toStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton);
                    if (toStorageDetail == null)
                    {
                        toStorageDetail = new StorageDetail();
                        toStorageDetail.AvailableQty       = 0;
                        toStorageDetail.CartonNo           = tcarton;
                        toStorageDetail.CDate              = FormatHelper.TODateInt(DateTime.Now);
                        toStorageDetail.CTime              = FormatHelper.TOTimeInt(DateTime.Now);
                        toStorageDetail.CUser              = userCode;
                        toStorageDetail.DQMCode            = fromStorageDetail.DQMCode;
                        toStorageDetail.FacCode            = fromStorageDetail.FacCode;
                        toStorageDetail.FreezeQty          = 0;
                        toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate;
                        toStorageDetail.LocationCode       = tLocationCode;
                        toStorageDetail.Lotno              = fromStorageDetail.Lotno;
                        toStorageDetail.MaintainDate       = FormatHelper.TODateInt(DateTime.Now);
                        toStorageDetail.MaintainTime       = FormatHelper.TOTimeInt(DateTime.Now);
                        toStorageDetail.MaintainUser       = userCode;
                        toStorageDetail.MCode              = fromStorageDetail.MCode;
                        toStorageDetail.MDesc              = fromStorageDetail.MDesc;
                        toStorageDetail.ProductionDate     = fromStorageDetail.ProductionDate;
                        toStorageDetail.ReworkApplyUser    = fromStorageDetail.ReworkApplyUser;
                        toStorageDetail.StorageAgeDate     = fromStorageDetail.StorageAgeDate;
                        toStorageDetail.StorageCode        = fromStorageDetail.StorageCode;
                        toStorageDetail.StorageQty         = 0;
                        toStorageDetail.SupplierLotNo      = fromStorageDetail.SupplierLotNo;
                        toStorageDetail.Unit           = fromStorageDetail.Unit;
                        toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate;
                        facade.AddStorageDetail(toStorageDetail);
                    }

                    toStorageDetail.StorageQty   += fromStorageDetail.StorageQty;
                    toStorageDetail.AvailableQty += fromStorageDetail.AvailableQty;



                    facade.UpdateStorageDetail(toStorageDetail);

                    StorloctransDetail storloctransDetail = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode);
                    storloctransDetail.Qty += fromStorageDetail.AvailableQty;
                    _WarehouseFacade.UpdateStorloctransdetail(storloctransDetail);

                    #region 4,	向TBLStorLocTransDetailCarton插入一笔数据。
                    StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton();
                    newstorlocDetailCarton.Transno          = transNo;                 //storlocDetailCarton.Transno = StorLocTransDetail.TransNo;
                    newstorlocDetailCarton.MCode            = fromStorageDetail.MCode; //MCODE:TBLStorLocTransDetail.MCODE
                    newstorlocDetailCarton.DqmCode          = fromStorageDetail.DQMCode;
                    newstorlocDetailCarton.FacCode          = "10Y2";
                    newstorlocDetailCarton.Qty              = fromStorageDetail.StorageQty;   //QTY: TBLStorageDetail. storageQTY
                    newstorlocDetailCarton.LocationCode     = tLocationCode;                  //LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找)
                    newstorlocDetailCarton.Cartonno         = tcarton;                        //CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit
                    newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode
                    newstorlocDetailCarton.Fromcartonno     = fromStorageDetail.CartonNo;     //FromCARTONNO:TBLStorageDetail. CARTONNO
                    newstorlocDetailCarton.Lotno            = fromStorageDetail.Lotno;        //LotNo:TBLStorageDetail. LotNo
                    newstorlocDetailCarton.CUser            = userCode;                       //	CUSER
                    newstorlocDetailCarton.CDate            = dbDateTime.DBDate;              //	CDATE
                    newstorlocDetailCarton.CTime            = dbDateTime.DBTime;              //	CTIME
                    newstorlocDetailCarton.MaintainDate     = dbDateTime.DBDate;              //	MDATE
                    newstorlocDetailCarton.MaintainTime     = dbDateTime.DBTime;              //	MTIME
                    newstorlocDetailCarton.MaintainUser     = userCode;
                    _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton);
                    #endregion
                    //5,	如果原箱号在TBLStorageDetailSN有SN信息,将SN信息插入到TBLStorLocTransDetailSN表
                    object[] storageDetailSnlist = facade.GetStorageDetailSnbyCarton(fromCarton);
                    if (storageDetailSnlist != null)
                    {
                        foreach (StorageDetailSN newStorageDetailSn in storageDetailSnlist)
                        {
                            #region add TBLStorageDetailSN
                            StorloctransDetailSN newStorloctransDetailSn = new StorloctransDetailSN();
                            newStorloctransDetailSn.Sn           = newStorageDetailSn.SN; //SN:TBLStorageDetailSN.SN
                            newStorloctransDetailSn.Transno      = transNo;               // TBLStorLocTransDetail. TransNo
                            newStorloctransDetailSn.Fromcartonno = fromCarton;            //FromCARTONNO:TBLStorageDetail.LocationCode
                            newStorloctransDetailSn.Cartonno     = tcarton;               //FormatHelper.CleanString(txtTLocationCodeEdit.Text);//CARTONNO:TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找)
                            newStorloctransDetailSn.MaintainDate = dbDateTime.DBDate;     //	MDATE
                            newStorloctransDetailSn.MaintainTime = dbDateTime.DBTime;     //	MTIME
                            newStorloctransDetailSn.MaintainUser = userCode;
                            _WarehouseFacade.AddStorloctransdetailsn(newStorloctransDetailSn);

                            newStorageDetailSn.CartonNo     = tcarton;
                            newStorageDetailSn.MaintainDate = FormatHelper.TODateInt(DateTime.Now);
                            newStorageDetailSn.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
                            newStorageDetailSn.MaintainUser = userCode;
                            facade.UpdateStorageDetailSN(newStorageDetailSn);
                            #endregion
                        }
                    }
                }
                #endregion

                #region【拆箱】:
                else if (statusList == CartonType.CartonType_SplitCarton)
                {
                    Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(storageCarton.MCode);
                    if (material != null)
                    {
                        //2单件管控IsInt
                        if (material.MCONTROLTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS)
                        {
                            #region     单件管控:

                            msgsn = "SN:" + inputsn;
                            if (string.IsNullOrEmpty(inputsn))
                            {
                                msg = "此箱为单件管控,请输入SN。";
                                return(msg);
                            }


                            StorageDetailSN storageDetailSn = (StorageDetailSN)facade.GetStorageDetailSN(inputsn);

                            if (storageDetailSn == null)
                            {
                                return("此SN不存在!");
                            }
                            if (storageDetailSn.CartonNo != fromCarton)
                            {
                                return("原箱中不存在此SN!");
                            }



                            decimal storageQTY = fromStorageDetail.StorageQty - fromStorageDetail.FreezeQty;
                            if (storageQTY <= 0)
                            {
                                return("原箱号的库存数量不足:" + storageQTY);
                            }



                            if (toStorageDetail == null)
                            {
                                toStorageDetail = new StorageDetail();
                                toStorageDetail.AvailableQty       = 0;
                                toStorageDetail.CartonNo           = tcarton;
                                toStorageDetail.CDate              = FormatHelper.TODateInt(DateTime.Now);
                                toStorageDetail.CTime              = FormatHelper.TOTimeInt(DateTime.Now);
                                toStorageDetail.CUser              = userCode;
                                toStorageDetail.DQMCode            = fromStorageDetail.DQMCode;
                                toStorageDetail.FacCode            = fromStorageDetail.FacCode;
                                toStorageDetail.FreezeQty          = 0;
                                toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate;
                                toStorageDetail.LocationCode       = tLocationCode;
                                toStorageDetail.Lotno              = fromStorageDetail.Lotno;
                                toStorageDetail.MaintainDate       = FormatHelper.TODateInt(DateTime.Now);
                                toStorageDetail.MaintainTime       = FormatHelper.TOTimeInt(DateTime.Now);
                                toStorageDetail.MaintainUser       = userCode;
                                toStorageDetail.MCode              = fromStorageDetail.MCode;
                                toStorageDetail.MDesc              = fromStorageDetail.MDesc;
                                toStorageDetail.ProductionDate     = fromStorageDetail.ProductionDate;
                                toStorageDetail.ReworkApplyUser    = fromStorageDetail.ReworkApplyUser;
                                toStorageDetail.StorageAgeDate     = fromStorageDetail.StorageAgeDate;
                                toStorageDetail.StorageCode        = fromStorageDetail.StorageCode;
                                toStorageDetail.StorageQty         = 0;
                                toStorageDetail.SupplierLotNo      = fromStorageDetail.SupplierLotNo;
                                toStorageDetail.Unit           = fromStorageDetail.Unit;
                                toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate;
                                facade.AddStorageDetail(toStorageDetail);
                            }


                            #region add by sam 2016年4月27日
                            storageDetailSn.CartonNo = tcarton;
                            facade.UpdateStorageDetailSN(storageDetailSn);

                            fromStorageDetail.StorageQty   -= 1;
                            fromStorageDetail.AvailableQty -= 1;
                            facade.UpdateStorageDetail(fromStorageDetail);

                            toStorageDetail               = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton);
                            toStorageDetail.StorageQty   += 1;
                            toStorageDetail.AvailableQty += 1;
                            facade.UpdateStorageDetail(toStorageDetail);
                            #endregion


                            StorloctransDetail storloctransDetail = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode);
                            storloctransDetail.Qty += fromStorageDetail.AvailableQty;
                            _WarehouseFacade.UpdateStorloctransdetail(storloctransDetail);
                            StorloctransDetailCarton storloctransDetailCarton =
                                (StorloctransDetailCarton)
                                _WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton,
                                                                             tcarton);
                            if (storloctransDetailCarton != null)
                            {// 如果有: 更新TBLStorLocTransDetailCarton.QTY+ PDA页面填的数量,MDate,MTime,MUser。
                                storloctransDetailCarton.Qty         += 1;
                                storloctransDetailCarton.MaintainDate = dbDateTime.DBDate;
                                storloctransDetailCarton.MaintainTime = dbDateTime.DBTime;
                                storloctransDetailCarton.MaintainUser = userCode;
                                _WarehouseFacade.UpdateStorloctransdetailcarton(storloctransDetailCarton);
                            }
                            else
                            {
                                #region 4,	向TBLStorLocTransDetailCarton插入一笔数据。


                                StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton();
                                newstorlocDetailCarton.Transno          = transNo;// storloctransdetailObj.Transno;   //storlocDetailCarton.Transno = StorLocTransDetail.TransNo;
                                newstorlocDetailCarton.DqmCode          = storloctransdetailObj.DqmCode;
                                newstorlocDetailCarton.FacCode          = "10Y2";
                                newstorlocDetailCarton.MCode            = storloctransdetailObj.MCode;    //MCODE:TBLStorLocTransDetail.MCODE
                                newstorlocDetailCarton.Qty              = 1;                              //   //QTY: 1
                                newstorlocDetailCarton.LocationCode     = tLocationCode;                  // FormatHelper.CleanString(txtTLocationCodeEdit.Text);//LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找)
                                newstorlocDetailCarton.Cartonno         = tcarton;                        // FormatHelper.CleanString(txtTLocationCartonEdit.Text);//CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit
                                newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode
                                newstorlocDetailCarton.Fromcartonno     = fromCarton;                     // rageDetail.CartonNo; //FromCARTONNO:TBLStorageDetail. CARTONNO
                                newstorlocDetailCarton.Lotno            = fromStorageDetail.Lotno;        //LotNo:TBLStorageDetail. LotNo
                                newstorlocDetailCarton.CUser            = userCode;                       //	CUSER
                                newstorlocDetailCarton.CDate            = dbDateTime.DBDate;              //	CDATE
                                newstorlocDetailCarton.CTime            = dbDateTime.DBTime;              //	CTIME
                                newstorlocDetailCarton.MaintainDate     = dbDateTime.DBDate;              //	MDATE
                                newstorlocDetailCarton.MaintainTime     = dbDateTime.DBTime;              //	MTIME
                                newstorlocDetailCarton.MaintainUser     = userCode;
                                _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton);
                                #endregion

                                //说明:表中没有的字段来自TBLStorageDetail中对应字段
                                //F  向表TBLStorLocTransDetailSN插入一条数据。


                                StorloctransDetailSN newStorloctransDetailSn = new StorloctransDetailSN();
                                newStorloctransDetailSn.Sn           = inputsn;                       //SN:TBLStorageDetailSN.SN
                                newStorloctransDetailSn.Transno      = storloctransdetailObj.Transno; // TBLStorLocTransDetail. TransNo
                                newStorloctransDetailSn.Fromcartonno = fromCarton;                    //TBLStorageDetail.LocationCode
                                newStorloctransDetailSn.Cartonno     = tcarton;                       // FormatHelper.CleanString(txtTLocationCodeEdit.Text);//CARTONNO:TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找)
                                newStorloctransDetailSn.MaintainDate = dbDateTime.DBDate;             //	MDATE
                                newStorloctransDetailSn.MaintainTime = dbDateTime.DBTime;             //	MTIME
                                newStorloctransDetailSn.MaintainUser = userCode;
                                _WarehouseFacade.AddStorloctransdetailsn(newStorloctransDetailSn);
                            }
                            #endregion
                        }
                        else
                        {
                            #region 和非单件管控


                            //B 检查TBLStorageDetail. AvailableQTY>PDA页面填的数量。如果否,提示:输入的数量大于库存可用数量。
                            #region Check 数量
                            int qty;
                            if (!string.IsNullOrEmpty(inputqty))
                            {
                                try
                                {
                                    qty = Int32.Parse(inputqty);
                                }
                                catch (Exception ex)
                                {
                                    msg = "数量只能输入大于0的数字";
                                    return(msg);
                                }
                                if (qty <= 0)
                                {
                                    msg = "数量只能输入大于0的数字";
                                    return(msg);
                                }
                            }
                            else
                            {
                                msg = "数量不能为空";
                                return(msg);
                            }
                            #endregion

                            decimal stroageQTY = fromStorageDetail.StorageQty - fromStorageDetail.FreezeQty;

                            if (stroageQTY < qty)
                            {
                                msg = "输入的数量大于库存可用数量";
                                return(msg);
                            }

                            fromStorageDetail.AvailableQty -= qty;
                            fromStorageDetail.StorageQty   -= qty;
                            facade.UpdateStorageDetail(fromStorageDetail);



                            if (toStorageDetail == null)
                            {
                                toStorageDetail = new StorageDetail();
                                toStorageDetail.AvailableQty       = 0;
                                toStorageDetail.CartonNo           = tcarton;
                                toStorageDetail.CDate              = FormatHelper.TODateInt(DateTime.Now);
                                toStorageDetail.CTime              = FormatHelper.TOTimeInt(DateTime.Now);
                                toStorageDetail.CUser              = userCode;
                                toStorageDetail.DQMCode            = fromStorageDetail.DQMCode;
                                toStorageDetail.FacCode            = fromStorageDetail.FacCode;
                                toStorageDetail.FreezeQty          = 0;
                                toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate;
                                toStorageDetail.LocationCode       = tLocationCode;
                                toStorageDetail.Lotno              = fromStorageDetail.Lotno;
                                toStorageDetail.MaintainDate       = FormatHelper.TODateInt(DateTime.Now);
                                toStorageDetail.MaintainTime       = FormatHelper.TOTimeInt(DateTime.Now);
                                toStorageDetail.MaintainUser       = userCode;
                                toStorageDetail.MCode              = fromStorageDetail.MCode;
                                toStorageDetail.MDesc              = fromStorageDetail.MDesc;
                                toStorageDetail.ProductionDate     = fromStorageDetail.ProductionDate;
                                toStorageDetail.ReworkApplyUser    = fromStorageDetail.ReworkApplyUser;
                                toStorageDetail.StorageAgeDate     = fromStorageDetail.StorageAgeDate;
                                toStorageDetail.StorageCode        = fromStorageDetail.StorageCode;
                                toStorageDetail.StorageQty         = 0;
                                toStorageDetail.SupplierLotNo      = fromStorageDetail.SupplierLotNo;
                                toStorageDetail.Unit           = fromStorageDetail.Unit;
                                toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate;
                                facade.AddStorageDetail(toStorageDetail);
                            }

                            toStorageDetail               = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton);
                            toStorageDetail.StorageQty   += qty;
                            toStorageDetail.AvailableQty += qty;

                            facade.UpdateStorageDetail(toStorageDetail);

                            StorloctransDetailCarton storloctransDetailCarton =
                                (StorloctransDetailCarton)
                                _WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton,
                                                                             tcarton);
                            if (storloctransDetailCarton != null)
                            {                                                // 如果有: 更新TBLStorLocTransDetailCarton.QTY+ PDA页面填的数量,MDate,MTime,MUser。
                                storloctransDetailCarton.Qty         += qty; // int.Parse(txtNumEdit.Text);
                                storloctransDetailCarton.MaintainDate = dbDateTime.DBDate;
                                storloctransDetailCarton.MaintainTime = dbDateTime.DBTime;
                                storloctransDetailCarton.MaintainUser = userCode;
                                _WarehouseFacade.UpdateStorloctransdetailcarton(storloctransDetailCarton);
                            }
                            else
                            {
                                #region 如果没有:插入一条数据     向TBLStorLocTransDetailCarton插入一笔数据。
                                StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton();
                                newstorlocDetailCarton.Transno          = transNo;                        // storloctransdetailObj.Transno;
                                newstorlocDetailCarton.DqmCode          = fromStorageDetail.DQMCode;      // storloctransdetailObj.DqmCode;
                                newstorlocDetailCarton.FacCode          = fromStorageDetail.FacCode;
                                newstorlocDetailCarton.MCode            = storageCarton.MCode;            // storloctransdetailObj.MCode;//MCODE:TBLStorLocTransDetail.MCODE
                                newstorlocDetailCarton.Qty              = qty;                            //QTY: 1
                                newstorlocDetailCarton.LocationCode     = tLocationCode;                  //FormatHelper.CleanString(txtTLocationCodeEdit.Text);//LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找)
                                newstorlocDetailCarton.Cartonno         = tcarton;                        // FormatHelper.CleanString(txtTLocationCartonEdit.Text);//CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit
                                newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode
                                newstorlocDetailCarton.Fromcartonno     = fromCarton;                     // storageDetail.CartonNo; //FromCARTONNO:TBLStorageDetail. CARTONNO
                                newstorlocDetailCarton.Lotno            = storageCarton.Lotno;            //LotNo:TBLStorageDetail. LotNo
                                newstorlocDetailCarton.CUser            = userCode;                       //	CUSER
                                newstorlocDetailCarton.CDate            = dbDateTime.DBDate;              //	CDATE
                                newstorlocDetailCarton.CTime            = dbDateTime.DBTime;              //	CTIME
                                newstorlocDetailCarton.MaintainDate     = dbDateTime.DBDate;              //	MDATE
                                newstorlocDetailCarton.MaintainTime     = dbDateTime.DBTime;              //	MTIME
                                newstorlocDetailCarton.MaintainUser     = userCode;
                                _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton);
                                #endregion
                            }
                            #endregion
                        }
                    }
                }
                #endregion



                fromStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(fromCarton);
                if (fromStorageDetail != null && fromStorageDetail.StorageQty == 0)
                {
                    _WarehouseFacade.DeleteStorageDetail(fromStorageDetail);
                }



                string documentno = CreateAutoDocmentsNo();
                SaveDocmentsNo(documentno, userCode);

                this.DataProvider.CommitTransaction();
                msg = "提交成功";
                return(msg);
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                msg = ex.Message;
                return(msg);
            }
        }