Example #1
0
        public bool FirstCheckWithUser(string[] asns, string userCode, out string message)
        {
            try
            {
                WarehouseFacade facade  = new WarehouseFacade(DataProvider);
                InventoryFacade facade1 = new InventoryFacade(DataProvider);
                message = string.Empty;
                Asn asn = (Asn)facade.GetAsn(asns[0]);

                if (asn.Direct_flag.ToUpper() == "Y")
                {
                    message = "该入库指令是供应商直发,不能做以下操作[取消下发][初检][申请IQC]";
                    return(false);
                }

                if (asn.Status == ASNHeadStatus.WaitReceive)
                {
                    this.DataProvider.BeginTransaction();

                    string stNo = string.Format("'{0}'", asn.Stno);

                    facade1.UpdateASNStatusByStNo(ASNHeadStatus.Receive, stNo);
                    facade1.UpdateASNDetailStatusByStNo(ASNHeadStatus.Receive, stNo);
                    DBDateTime      dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    WarehouseFacade _wa     = new WarehouseFacade(DataProvider);
                    InvInOutTrans   trans   = _wa.CreateNewInvInOutTrans();
                    trans.CartonNO        = string.Empty;
                    trans.DqMCode         = " ";
                    trans.FacCode         = asn.FacCode;
                    trans.FromFacCode     = string.Empty;
                    trans.FromStorageCode = string.Empty;
                    trans.InvNO           = asn.Invno;
                    trans.InvType         = asn.StType;
                    trans.LotNo           = string.Empty;
                    trans.MaintainDate    = dbTime1.DBDate;
                    trans.MaintainTime    = FormatHelper.TOTimeInt(DateTime.Now);
                    trans.MaintainUser    = userCode;
                    trans.MCode           = " ";
                    trans.ProductionDate  = 0;
                    trans.Qty             = 0;
                    trans.Serial          = 0;
                    trans.StorageAgeDate  = 0;
                    trans.StorageCode     = asn.StorageCode;
                    trans.SupplierLotNo   = string.Empty;
                    trans.TransNO         = asn.Stno;
                    trans.TransType       = "IN";
                    trans.Unit            = string.Empty;
                    trans.ProcessType     = "RECEIVEBEGIN";
                    _wa.AddInvInOutTrans(trans);


                    this.DataProvider.CommitTransaction();
                    message = "初检成功";
                    return(true);
                }
                else if (asn.Status == ASNHeadStatus.Receive)
                {
                    message = "初检成功";
                    return(true);
                }
                else
                {
                    message = "状态必须是初见签收中或者待收货!";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                DataProvider.RollbackTransaction();
                BenQGuru.eMES.Common.Log.Error(ex.StackTrace);
                throw ex;
            }
        }
        protected override DataRow GetGridRow(object obj)
        {
            WarehouseFacade _facade    = new WarehouseFacade(base.DataProvider);
            DBDateTime      dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
            DataRow         row        = this.DtSource.NewRow();
            Asn             asn        = (Asn)_facade.GetAsn(((AsndetailEX)obj).Stno);

            row["BigCartonNO"]   = ((AsndetailEX)obj).Cartonbigseq;
            row["SmallCartonNO"] = ((AsndetailEX)obj).Cartonseq;
            row["CartonNO"]      = ((AsndetailEX)obj).Cartonno;
            row["DQLotNO"]       = ((AsndetailEX)obj).Lotno;

            if (((AsndetailEX)obj).InitreceiveStatus == "Reject")
            {
                row["ASNStatus"] = this.GetStatusName(((AsndetailEX)obj).InitreceiveStatus);
            }
            else
            {
                row["ASNStatus"] = this.GetStatusName(((AsndetailEX)obj).Status);
            }
            row["DQMaterialNo"]     = ((AsndetailEX)obj).DqmCode;
            row["DQMaterialNoDesc"] = ((AsndetailEX)obj).MDesc;
            row["VendorMCODE"]      = asn.StType == "UB" ? ((AsndetailEX)obj).CustmCode : ((AsndetailEX)obj).VEndormCode;
            row["VendorMCODEDesc"]  = ((Asndetail)obj).VEndormCodeDesc;
            row["ASNQTY"]           = ((AsndetailEX)obj).Qty.ToString();
            row["ReceiveQTY"]       = ((AsndetailEX)obj).ReceiveQty.ToString();
            row["ImportQTY"]        = ((AsndetailEX)obj).ActQty.ToString();
            row["MUOM"]             = ((AsndetailEX)obj).Unit;
            row["ProDate"]          = FormatHelper.ToDateString(((AsndetailEX)obj).Production_Date);
            row["VendorLotNo"]      = ((AsndetailEX)obj).Supplier_lotno;
            row["MControlType"]     = this.languageComponent1.GetString(((AsndetailEX)obj).MControlType);



            if (asn != null)
            {
                string createTime = asn.CDate.ToString() + " " + FormatHelper.ToTimeString(asn.CTime);
                row["ASNCreateTime"] = createTime;
            }

            BenQGuru.eMES.IQC.IQCFacade iqcFacade = new BenQGuru.eMES.IQC.IQCFacade(base.DataProvider);
            row["ReformCount"] = iqcFacade.ReformQtyTotalWithStNoLine(((AsndetailEX)obj).Stno, ((AsndetailEX)obj).Stline);
            row["ReturnCount"] = iqcFacade.ReturnQtyTotalWithStNoLine(((AsndetailEX)obj).Stno, ((AsndetailEX)obj).Stline);
            string status = ((AsndetailEX)obj).Status;

            if (status == ASNHeadStatus.Release || status == ASNHeadStatus.WaitReceive || status == ASNHeadStatus.Receive)
            {
                row["RejectCount"] = 0;
            }
            else
            {
                row["RejectCount"] = ((AsndetailEX)obj).Qty - ((AsndetailEX)obj).ReceiveQty;
            }



            row["CartonMemo"] = ((AsndetailEX)obj).Remark1;
            row["stline"]     = ((AsndetailEX)obj).Stline.ToString();

            string flag = _WarehouseFacade.GetShipToStock(((AsndetailEX)obj).MCode, dbDateTime.DBDate);

            row["FreeCheckMcode"] = flag;
            return(row);
        }