예제 #1
0
 //Grid中点击按钮
 protected override void Grid_ClickCell(GridRecord row, string commandName)
 {
     if (_IQCFacade == null)
     {
         _IQCFacade = new IQCFacade(base.DataProvider);
     }
     if (commandName == "btnInspect")
     {
         string iqcNo = row.Items.FindItemByKey("IQCNo").Text.Trim();
         AsnIQC iqc   = (AsnIQC)_IQCFacade.GetAsnIQC(iqcNo);
         if (iqc.Status == IQCStatus.IQCStatus_Cancel)
         {
             WebInfoPublish.Publish(this, "IQC检验单已取消!", this.languageComponent1);
             return;
         }
         else if (iqc.Status == IQCStatus.IQCStatus_Release)
         {
             //更新检验单状态为WaitCheck
             AsnIQC asnIqc = (AsnIQC)_IQCFacade.GetAsnIQC(iqcNo);
             asnIqc.Status = IQCStatus.IQCStatus_WaitCheck;
             _IQCFacade.UpdateAsnIQC(asnIqc);
         }
         Response.Redirect(this.MakeRedirectUrl("FIQCCheckResultMP.aspx", new string[] { "IQCNo" }, new string[] { iqcNo }));
     }
 }
예제 #2
0
        //检查ASN明细所有行状态为Cancel
        /// <summary>
        /// 检查ASN明细所有行状态为Cancel
        /// </summary>
        /// <param name="iqcNo">IQC检验单号</param>
        /// <returns>全部是Cancel:true;否则:false</returns>
        private bool CheckAllASNDetailIsCancel(string iqcNo)
        {
            if (_IQCFacade == null)
            {
                _IQCFacade = new IQCFacade(base.DataProvider);
            }
            _InventoryFacade = new InventoryFacade(base.DataProvider);

            AsnIQC asnIqc = (AsnIQC)_IQCFacade.GetAsnIQC(iqcNo);

            if (asnIqc != null)
            {
                object[] objAsnDetail = _InventoryFacade.GetASNDetailByStNo(asnIqc.StNo);
                if (objAsnDetail != null)
                {
                    foreach (ASNDetail asnDetail in objAsnDetail)
                    {
                        if (asnDetail.Status != ASNLineStatus.Cancel)
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
예제 #3
0
        //免检
        protected void cmdStatusSTS_ServerClick(object sender, EventArgs e)
        {
            if (_IQCFacade == null)
            {
                _IQCFacade = new IQCFacade(base.DataProvider);
            }
            ArrayList array = this.gridHelper.GetCheckedRows();

            _InventoryFacade = new InventoryFacade(base.DataProvider);
            if (array.Count > 0)
            {
                StringBuilder sbShowMsg = new StringBuilder();
                foreach (GridRecord row in array)
                {
                    string iqcNo = row.Items.FindItemByKey("IQCNo").Value.ToString();
                    AsnIQC iqc   = (AsnIQC)_IQCFacade.GetAsnIQC(iqcNo);


                    if (iqc.Status != IQCStatus.IQCStatus_Release)
                    {
                        //IQC检验单号: {0} 状态不是初始化
                        sbShowMsg.AppendFormat("IQC检验单号: {0} 状态不是初始化,不能免检 ", iqcNo);
                        continue;
                    }

                    ASN asn1 = (ASN)_InventoryFacade.GetASN(iqc.StNo);
                    if (asn1.Status != ASN_STATUS.ASN_IQC)
                    {
                        WebInfoPublish.Publish(this, asn1.StNo + "入库指令的状态必须是IQC检验!", this.languageComponent1);
                        return;
                    }
                    //免检
                    try
                    {
                        this.DataProvider.BeginTransaction();
                        ToSTS(iqcNo);
                        this.DataProvider.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        sbShowMsg.AppendFormat("IQC检验单号: {0} {1}", iqcNo, ex.Message);
                        this.DataProvider.RollbackTransaction();
                        continue;
                    }
                }
                if (sbShowMsg.Length > 0)
                {
                    string showMsg = sbShowMsg.ToString();
                    WebInfoPublish.Publish(this, showMsg, this.languageComponent1);
                }
                else
                {
                    WebInfoPublish.Publish(this, "免检成功", this.languageComponent1);
                }
                this.gridHelper.RequestData();//刷新页面
            }
        }
예제 #4
0
        public string SaveIQCInfo(string[] asns, string usrCode)
        {
            WarehouseFacade wFacade = new WarehouseFacade(DataProvider);

            InventoryFacade facade = new InventoryFacade(DataProvider);

            BenQGuru.eMES.Web.Helper.DBDateTime dbDateTime = BenQGuru.eMES.Web.Helper.FormatHelper.GetNowDBDateTime(this.DataProvider);
            #region 6>	以下几种情况不可点击申请IQC:
            //1》 入库类型为:PD:盘点
            //2》 入库类型为:POR: PO入库 并且供应商直发标识为:Y
            //3》 入库类型为:SCTR:生产退料 并且生产退料入不良品库标识为:Y


            ASN asn = (ASN)facade.GetASN(asns[0]);

            if (asn.StType == InInvType.PD)
            {
                return("入库类型为盘点,不可申请IQC");
            }
            else if (asn.StType == InInvType.POR && asn.DirectFlag == "Y")
            {
                return("入库类型为PO入库并且供应商直发标识为Y,不可申请IQC");
            }

            else if (asn.StType == InInvType.SCTR && asn.RejectsFlag == "Y")
            {
                return("入库类型为生产退料并且生产退料入不良品库标识为Y,不可申请IQC");
            }


            bool hasDetail = facade.CheckASNHasDetail(asn.StNo, ASNLineStatus.ReceiveClose);
            if (!hasDetail)
            {
                bool hasReject = facade.CheckASNReceiveStatusHasDetail(asn.StNo, "Reject");
                if (hasReject)
                {
                    //将头数据改为拒收状态 IQCRejection:IQC拒收;
                    ASN oldAsn = (ASN)facade.GetASN(asn.StNo);
                    oldAsn.Status = ASNHeadStatus.IQCRejection;
                    facade.UpdateASN(oldAsn);
                    return("初检接收状态中全部为拒收状态");
                }
            }
            else
            {
                return("ASN单行项目状态必须为初检完成");
            }
            #endregion

            IQCFacade iqcFacade      = new IQCFacade(DataProvider);
            object[]  disdqMcodeList = facade.QueryAsnDetailForDqMcode(asn.StNo);
            if (disdqMcodeList == null)
            {
                return("入库指令号对应在ASN明细表中不存在,不可申请IQC");
            }


            //同一入库指令下,同一鼎桥物料编码,生成一个IQC检验单号。
            object[] dqMcodeList = facade.QueryAsnDetailForCreateIqc(asn.StNo);
            if (dqMcodeList == null)
            {
                return("IQC检验单号已存在!");
            }


            try
            {
                this.DataProvider.BeginTransaction();
                string iqcNo = string.Empty;
                foreach (ASNDetail dqMcode in dqMcodeList)
                {
                    //edit by sam 2016年3月21日 剔除拒收状态
                    object[] detailList = facade.QueryAsnDetailByStNo(asn.StNo, dqMcode.DQMCode, "Reject");
                    if (detailList != null)
                    {
                        #region AsnIQC
                        ASNDetail asnDetailobj = detailList[0] as ASNDetail;
                        string    newIqcNo     = this.CreateNewIqcNo(asnDetailobj.StNo, usrCode);
                        AsnIQC    asnIqc       = new AsnIQC();
                        asnIqc.IqcNo   = newIqcNo;
                        iqcNo          = newIqcNo;
                        asnIqc.IqcType = "";
                        asnIqc.StNo    = asn.StNo;
                        asnIqc.InvNo   = !string.IsNullOrEmpty(asn.InvNo) ? asn.InvNo : asn.StNo;


                        asnIqc.StType    = asn.StType;                                           //	 STTYPE
                        asnIqc.Status    = BenQGuru.eMES.Web.Helper.IQCStatus.IQCStatus_Release; //	STATUS
                        asnIqc.AppDate   = dbDateTime.DBDate;                                    //	MDATE
                        asnIqc.AppTime   = dbDateTime.DBTime;                                    //	MTIME
                        asnIqc.InspDate  = 0;                                                    //	INSPDATE
                        asnIqc.InspTime  = 0;                                                    //	INSPTIME
                        asnIqc.CustmCode = asnDetailobj.CustMCode;                               //	CUSTMCODE 华为物料号
                        asnIqc.MCode     = asnDetailobj.MCode;                                   //	MCODE
                        asnIqc.DQMCode   = asnDetailobj.DQMCode;                                 //	DQMCODE
                        asnIqc.MDesc     = asnDetailobj.MDesc;                                   //	MDESC
                        // asnIqc.Qty = asnDetailobj.ReceiveQty;	//	QTY
                        asnIqc.QcStatus     = "";                                                //	QCSTATUS IQC状态(Y:合格;N:不合格)
                        asnIqc.VendorCode   = asn.VendorCode;                                    //	VENDORCODE
                        asnIqc.VendorMCode  = asnDetailobj.VendorMCodeDesc;                      //	VENDORMCODE
                        asnIqc.Remark1      = asn.Remark1;                                       //	REMARK1
                        asnIqc.CUser        = usrCode;                                           //	CUSER
                        asnIqc.CDate        = dbDateTime.DBDate;                                 //	CDATE
                        asnIqc.CTime        = dbDateTime.DBTime;                                 //	CTIME
                        asnIqc.MaintainDate = dbDateTime.DBDate;                                 //	MDATE
                        asnIqc.MaintainTime = dbDateTime.DBTime;                                 //	MTIME
                        asnIqc.MaintainUser = usrCode;                                           //	MUSER
                        foreach (ASNDetail asnDetail in detailList)
                        {
                            asnIqc.Qty += asnDetail.ReceiveQty;
                        }
                        iqcFacade.AddAsnIQC(asnIqc);
                        #endregion
                        foreach (ASNDetail asnDetail in detailList)
                        {
                            #region
                            AsnIQCDetail iqcDetail = new AsnIQCDetail();

                            #region  iqcDetail
                            iqcDetail.IqcNo        = newIqcNo;             //	IQCNO	送检单号
                            iqcDetail.StNo         = asnDetail.StNo;       //	STNO	ASN单号
                            iqcDetail.StLine       = asnDetail.StLine;     //	STLINE	ASN单行项目
                            iqcDetail.CartonNo     = asnDetail.CartonNo;   //	CARTONNO	箱号条码
                            iqcDetail.Qty          = asnDetail.ReceiveQty; //	QTY	送检数量
                            iqcDetail.QcPassQty    = 0;                    //	QCPASSQTY	检验通过数量
                            iqcDetail.Unit         = asnDetail.Unit;       //	UNIT	单位
                            iqcDetail.NgQty        = 0;                    //	NGQTY	缺陷品数
                            iqcDetail.ReturnQty    = 0;                    //	ReturnQTY	退换货数量
                            iqcDetail.ReformQty    = 0;                    //	ReformQTY	现场整改数量
                            iqcDetail.GiveQty      = 0;                    //	GiveQTY	让步接收数量
                            iqcDetail.AcceptQty    = 0;                    //	AcceptQTY	特采数量
                            iqcDetail.QcStatus     = "";                   //	QCSTATUS	 IQC状态(Y:合格;N:不合格)
                            iqcDetail.Remark1      = asnDetail.Remark1;    //	REMARK1	备注
                            iqcDetail.CUser        = usrCode;              //	CUSER
                            iqcDetail.CDate        = dbDateTime.DBDate;    //	CDATE
                            iqcDetail.CTime        = dbDateTime.DBTime;    //	CTIME
                            iqcDetail.MaintainDate = dbDateTime.DBDate;    //	MDATE
                            iqcDetail.MaintainTime = dbDateTime.DBTime;    //	MTIME
                            iqcDetail.MaintainUser = usrCode;              //	MUSER
                            iqcFacade.AddAsnIQCDetail(iqcDetail);
                            #endregion

                            #region  AsnIqcDetailSN

                            object[] iqcDetailsnList = facade.GetSNbySTNo(asnDetail.StNo, asnDetail.StLine);
                            if (iqcDetailsnList != null)
                            {
                                foreach (Asndetailsn detailsn in iqcDetailsnList)
                                {
                                    AsnIqcDetailSN iqcDetailsn = new AsnIqcDetailSN();
                                    iqcDetailsn.IqcNo        = newIqcNo;           //	IQCNO	送检单号
                                    iqcDetailsn.StNo         = asnDetail.StNo;     //	STNO	ASN单号
                                    iqcDetailsn.StLine       = asnDetail.StLine;   //	STLINE	ASN单行项目
                                    iqcDetailsn.Sn           = detailsn.Sn;
                                    iqcDetailsn.CartonNo     = asnDetail.CartonNo; //	CARTONNO	箱号条码
                                    iqcDetailsn.StNo         = asnDetail.StNo;     //	SN	SN条码
                                    iqcDetailsn.QcStatus     = "";                 //	QCSTATUS	SN IQC状态(Y:合格;N:不合格)
                                    iqcDetailsn.Remark1      = asnDetail.Remark1;  //	REMARK1	备注
                                    iqcDetailsn.CUser        = usrCode;            //	CUSER
                                    iqcDetailsn.CDate        = dbDateTime.DBDate;  //	CDATE
                                    iqcDetailsn.CTime        = dbDateTime.DBTime;  //	CTIME
                                    iqcDetailsn.MaintainDate = dbDateTime.DBDate;  //	MDATE
                                    iqcDetailsn.MaintainTime = dbDateTime.DBTime;  //	MTIME
                                    iqcDetailsn.MaintainUser = usrCode;            //	MUSER
                                    iqcFacade.AddAsnIqcDetailSN(iqcDetailsn);
                                }
                            }
                            #endregion
                            #endregion
                        }
                    }
                    //判断是否是免检物料

                    BenQGuru.eMES.Domain.MOModel.Material mar = wFacade.GetMaterialFromDQMCode(dqMcode.DQMCode);
                    int count = wFacade.GetStockRecordCount(dbDateTime.DBDate, dbDateTime.DBTime, mar.MCode);
                    if (count > 0)
                    {
                        //是免检物料
                        try
                        {
                            ToSTS(iqcNo, usrCode);
                        }
                        catch (Exception ex)
                        {
                            this.DataProvider.RollbackTransaction();
                            throw ex;
                        }
                    }
                }
                // 3>	IQC检验单数据来源与ASN主表(TBLASN)、ASN明细表(TBLASNDETAIL)、ASN明细SN表(TBLASNDETAILSN),
                //保存数据表有:送检单(TBLASNIQC)、送检单明细(TBLASNIQCDETAIL)、送检单明细SN表(TBLASNIQCDETAILSN),
                //注:送检数量(TBLASNIQCDETAIL.QTY)为ASN明细表中的接收数量(TBLASNDETAIL.ReceiveQTY)
                //4>	IQC送检单号规则:IQC+入库指令号+两位流水号,如:IQCASN00000101

                //5>	更新ASN主表(TBLASN)状态为:IQC:IQC
                var oldasn = (ASN)facade.GetASN(asn.StNo);
                if (oldasn != null)
                {
                    if (!(oldasn.Status == ASN_STATUS.ASN_Close || oldasn.Status == ASN_STATUS.ASN_Cancel || oldasn.Status == ASN_STATUS.ASN_OnLocation || oldasn.Status == ASN_STATUS.ASN_IQC))
                    {
                        oldasn.Status = "IQC";
                        facade.UpdateASN(oldasn);
                    }
                }

                this.DataProvider.CommitTransaction();
                return("申请IQC成功");
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
        }
예제 #5
0
        private void ToSTS(string iqcNo, string userCode)
        {
            IQCFacade _IQCFacade = new IQCFacade(DataProvider);

            InventoryFacade _InventoryFacade = new InventoryFacade(DataProvider);

            //1、更新送检单TBLASNIQC
            AsnIQC asnIqc = (AsnIQC)_IQCFacade.GetAsnIQC(iqcNo);

            if (asnIqc != null)
            {
                asnIqc.IqcType  = "ExemptCheck";
                asnIqc.Status   = IQCStatus.IQCStatus_IQCClose;
                asnIqc.QcStatus = "Y";
                _IQCFacade.UpdateAsnIQC(asnIqc);

                #region 在invinouttrans表中增加一条数据
                WarehouseFacade facade = new WarehouseFacade(DataProvider);

                //ASN asn = (ASN)domainObject;
                DBDateTime    dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider);
                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.InvNo;
                trans.InvType         = asnIqc.IqcType;
                trans.LotNo           = string.Empty;
                trans.MaintainDate    = dbTime1.DBDate;
                trans.MaintainTime    = dbTime1.DBTime;
                trans.MaintainUser    = userCode;
                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         = asnIqc.IqcNo;
                trans.TransType       = "IN";
                trans.Unit            = string.Empty;
                trans.ProcessType     = "IQC";
                facade.AddInvInOutTrans(trans);
                #endregion
            }

            object[] objAsnIqcDetail = _IQCFacade.GetAsnIQCDetailByIqcNo(iqcNo);
            if (objAsnIqcDetail != null)
            {
                foreach (AsnIQCDetail asnIqcDetail in objAsnIqcDetail)
                {
                    //2、更新送检单明细TBLASNIQCDETAIL
                    asnIqcDetail.QcPassQty = asnIqcDetail.Qty;
                    asnIqcDetail.QcStatus  = "Y";
                    _IQCFacade.UpdateAsnIQCDetail(asnIqcDetail);


                    //4、更新ASN明细TBLASNDETAIL
                    ASNDetail asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(Convert.ToInt32(asnIqcDetail.StLine), asnIqcDetail.StNo);
                    if (asnDetail != null)
                    {
                        asnDetail.QcPassQty = asnDetail.ReceiveQty;
                        asnDetail.Status    = IQCStatus.IQCStatus_IQCClose;
                        _InventoryFacade.UpdateASNDetail(asnDetail);
                    }

                    //5、更新ASN明细对应单据行明细TBLASNDETAILITEM
                    object[] objAsnDetaileItem = _InventoryFacade.GetAsnDetailItem(asnIqcDetail.StNo, Convert.ToInt32(asnIqcDetail.StLine));
                    if (objAsnDetaileItem != null)
                    {
                        foreach (Asndetailitem asnDetaileItem in objAsnDetaileItem)
                        {
                            asnDetaileItem.QcpassQty = asnDetaileItem.ReceiveQty;
                            _InventoryFacade.UpdateAsndetailitem(asnDetaileItem);
                        }
                    }
                }
            }

            object[] objAsnIqcDetailSN = _IQCFacade.GetAsnIqcDetailSNByIqcNo(iqcNo);
            if (objAsnIqcDetailSN != null)
            {
                foreach (AsnIqcDetailSN asnIqcDetailSN in objAsnIqcDetailSN)
                {
                    //3、更新送检单明细SNTBLASNIQCDETAILSN
                    asnIqcDetailSN.QcStatus = "Y";
                    _IQCFacade.UpdateAsnIqcDetailSN(asnIqcDetailSN);

                    //6、更新ASN明细SN TBLASNDETAILSN
                    Asndetailsn asnDetailSn = (Asndetailsn)_InventoryFacade.GetAsndetailsn(asnIqcDetailSN.Sn, asnIqcDetailSN.StNo, Convert.ToInt32(asnIqcDetailSN.StLine));
                    if (asnDetailSn != null)
                    {
                        asnDetailSn.QcStatus = "Y";
                        _InventoryFacade.UpdateAsndetailsn(asnDetailSn);
                    }
                }
            }

            //7、以上表数据更新完成后检查ASN明细表(TBLASNDETAIL)所有行记录状态为:IQCClose:IQC完成 or OnLocation:上架 or Close:入库 or Cancel:取消时,
            //   更新ASN主表(TBLASN)状态(TBLASN.STATUS)为:OnLocation:上架
            bool isAllIQCClose   = CheckAllASNDetailIsIQCClose(iqcNo);
            bool isAllOnLocation = CheckAllASNDetailIsOnLocation(iqcNo);
            bool isAllClose      = CheckAllASNDetailIsClose(iqcNo);
            bool isAllCancel     = CheckAllASNDetailIsCancel(iqcNo);

            if (isAllIQCClose || isAllOnLocation ||
                isAllClose || isAllCancel
                )
            {
                ASN asn = (ASN)_InventoryFacade.GetASN(asnIqc.StNo);
                if (asn != null)
                {
                    asn.Status = ASNHeadStatus.OnLocation;
                    _InventoryFacade.UpdateASN(asn);
                }
            }
        }