Пример #1
0
        public AsnSimple GetAsnStatus(string stno)
        {
            AsnSimple       asnSimple        = new AsnSimple();
            InventoryFacade _InventoryFacade = new InventoryFacade(DataProvider);

            ASN asn = (ASN)_InventoryFacade.GetASN(stno);


            object[] objs = _InventoryFacade.GetASNDetailByStNo(stno);
            if (objs != null && objs.Length > 0)
            {
                foreach (ASNDetail d in objs)
                {
                    if (!string.IsNullOrEmpty(d.InitGIVEINDESC))
                    {
                        asnSimple.GiveReason = d.InitGIVEINDESC;
                        break;
                    }
                }
                foreach (ASNDetail d in objs)
                {
                    if (!string.IsNullOrEmpty(d.InitReceiveDesc))
                    {
                        asnSimple.RejectReason = d.InitReceiveDesc;
                        break;
                    }
                }
            }
            asnSimple.RejectCount = asn.InitRejectQty;

            return(asnSimple);
        }
Пример #2
0
        protected override string[] FormatExportRecord(object obj)
        {
            //return new string[]{((ASN)obj).StNo,
            //                    FormatHelper.ToDateString(((ASN)obj).CDate),
            //                    ((ASN)obj).CUser,
            //                    this.GetInvInName(((ASN)obj).StType),
            //                    ((ASN)obj).InvNo,
            //                    this.GetStatusName(((ASN)obj).Status),
            //                    ((ASN)obj).StorageCode,
            //                    FormatHelper.ToDateString(((ASN)obj).PreictDate),
            //                    ((ASN)obj).DirectFlag,
            //                    ((ASN)obj).PickNo,
            //                    ((ASN)obj).VendorCode,
            //                    ((ASN)obj).ExigencyFlag,
            //                    ((ASN)obj).RejectsFlag,
            //                    ((ASN)obj).OANo,
            //                    ((ASN)obj).PackingListNo,
            //                    FormatHelper.ToDateString(((ASN)obj).ProvideDate),
            //                    ((ASN)obj).GrossWeight.ToString(),
            //                    ((ASN)obj).Volume,
            //                    ((ASN)obj).FromStorageCode,
            //                    ((ASN)obj).Remark1
            //                  };
            string[] objs = new string[this.SAPHeadViewFieldList.Length];
            ASN      inv  = obj as ASN;
            Type     type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "CDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "StorageInType")
                {
                    strValue = this.GetInvInName(inv.StType);
                }
                else if (field.FieldName == "Status")
                {
                    strValue = this.GetStatusName(inv.Status);
                }
                else if (field.FieldName == "PredictDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PreictDate);
                }
                else if (field.FieldName == "ProvideDate")
                {
                    strValue = inv.ProvideDate;// FormatHelper.ToDateString(inv.ProvideDate);
                }
                objs[i] = strValue;
            }
            return(objs);
        }
Пример #3
0
        public void ASN(string ChannelId, string ChannelRef, string TransactionId, ASNHeadDoc aASNHeadDoc)
        {
            // transform external object to packaged object understandable by BizTalk
            ASN part = new ASN();

            part.ChannelId     = ChannelId;
            part.ChannelRef    = ChannelRef;
            part.TransactionId = TransactionId;
            part.aASNHeadDoc   = aASNHeadDoc;

            ArrayList inHeaders            = null;
            ArrayList inoutHeaders         = null;
            ArrayList inoutHeaderResponses = null;
            ArrayList outHeaderResponses   = null;

            SoapUnknownHeader[] unknownHeaderResponses = null;

            // Parameter information
            object[]    invokeParams  = new object[] { part };
            ParamInfo[] inParamInfos  = new ParamInfo[] { new ParamInfo(typeof(ASN), "part") };
            ParamInfo[] outParamInfos = null;

            // Define the assembly (port)
            // NOTE! This line is only a sample, it needs to be modified to match your orchestration
            // at least regarding your project name and the public access token
            string bodyTypeAssemblyQualifiedName = "YOUR_ORCHESTRATION_PROJECT.FromWMSschema+ASN, YOUR_ORCHESTRATION_PROJECT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" +
                                                   "92267163d02e63da";

            // BizTalk invocation
            // NOTE! This line is only a sample, it needs to be modified to match your orchestration
            // regarding the operation to call
            this.Invoke("Operation_1", invokeParams, inParamInfos, outParamInfos, 0, bodyTypeAssemblyQualifiedName, inHeaders, inoutHeaders, out inoutHeaderResponses, out outHeaderResponses, null, null, null, out unknownHeaderResponses, true, false);
        }
Пример #4
0
        protected void cmdReturn_ServerClick(object sender, EventArgs e)
        {
            //Response.Redirect(this.MakeRedirectUrl("FCreateIQCMP.aspx?iqcno=" + this.txtIQCNo.Text.Trim().ToUpper()));

            string  asnPO   = string.Empty;
            IQCHead iqcHead = (IQCHead)_IQCFacade.GetIQCHead(this.txtIQCNo.Text.Trim().ToUpper());

            if (iqcHead != null)
            {
                ASN asn = (ASN)_IQCFacade.GetASN(iqcHead.STNo);
                if (asn != null)
                {
                    asnPO = asn.STNo;
                }
            }

            if (asnPO.Trim().Length > 0)
            {
                Response.Redirect(this.MakeRedirectUrl("FCreateIQCMP.aspx?asnpo=" + asnPO));
            }
            else
            {
                Response.Redirect(this.MakeRedirectUrl("FCreateIQCMP.aspx"));
            }
        }
Пример #5
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();//刷新页面
            }
        }
Пример #6
0
        public WMSASNToDb(ASN wmsInfo)
            : base(s_metadata)
        {
            SetSqlInt64(0, wmsInfo.ID);
            SetSqlString(1, wmsInfo.ASNNumber == "" ? SqlTypes.SqlString.Null : wmsInfo.ASNNumber);
            SetSqlString(2, wmsInfo.ExternReceiptNumber == "" ? SqlTypes.SqlString.Null : wmsInfo.ExternReceiptNumber);
            SetSqlInt64(3, wmsInfo.CustomerID ?? SqlTypes.SqlInt64.Null);
            SetSqlString(4, wmsInfo.CustomerName == "" ? SqlTypes.SqlString.Null : wmsInfo.CustomerName);
            SetSqlInt64(5, wmsInfo.WarehouseID);
            SetSqlString(6, wmsInfo.WarehouseName == "" ? SqlTypes.SqlString.Null : wmsInfo.WarehouseName);
            SetSqlDateTime(7, wmsInfo.ExpectDate ?? SqlTypes.SqlDateTime.Null);
            SetSqlInt32(8, wmsInfo.Status);
            SetSqlString(9, wmsInfo.ASNType == "" ? SqlTypes.SqlString.Null : wmsInfo.ASNType);
            SetSqlString(10, wmsInfo.Creator == "" ? SqlTypes.SqlString.Null : wmsInfo.Creator);
            SetSqlDateTime(11, wmsInfo.CreateTime ?? SqlTypes.SqlDateTime.Null);
            SetSqlString(12, wmsInfo.Updator == "" ? SqlTypes.SqlString.Null : wmsInfo.Updator);
            SetSqlDateTime(13, wmsInfo.UpdateTime ?? SqlTypes.SqlDateTime.Null);
            SetSqlDateTime(14, wmsInfo.CompleteDate ?? SqlTypes.SqlDateTime.Null);
            SetSqlString(15, wmsInfo.Remark == "" ? SqlTypes.SqlString.Null : wmsInfo.Remark);

            #region 备用字段
            SetSqlString(16, wmsInfo.str1 == "" ? SqlTypes.SqlString.Null : wmsInfo.str1);
            SetSqlString(17, wmsInfo.str2 == "" ? SqlTypes.SqlString.Null : wmsInfo.str2);
            SetSqlString(18, wmsInfo.str3 == "" ? SqlTypes.SqlString.Null : wmsInfo.str3);
            SetSqlString(19, wmsInfo.str4 == "" ? SqlTypes.SqlString.Null : wmsInfo.str4);
            SetSqlString(20, wmsInfo.str5 == "" ? SqlTypes.SqlString.Null : wmsInfo.str5);
            SetSqlString(21, wmsInfo.str6 == "" ? SqlTypes.SqlString.Null : wmsInfo.str6);
            SetSqlString(22, wmsInfo.str7 == "" ? SqlTypes.SqlString.Null : wmsInfo.str7);
            SetSqlString(23, wmsInfo.str8 == "" ? SqlTypes.SqlString.Null : wmsInfo.str8);
            SetSqlString(24, wmsInfo.str9 == "" ? SqlTypes.SqlString.Null : wmsInfo.str9);
            SetSqlString(25, wmsInfo.str10 == "" ? SqlTypes.SqlString.Null : wmsInfo.str10);
            SetSqlString(26, wmsInfo.str11 == "" ? SqlTypes.SqlString.Null : wmsInfo.str11);
            SetSqlString(27, wmsInfo.str12 == "" ? SqlTypes.SqlString.Null : wmsInfo.str12);
            SetSqlString(28, wmsInfo.str13 == "" ? SqlTypes.SqlString.Null : wmsInfo.str13);
            SetSqlString(29, wmsInfo.str14 == "" ? SqlTypes.SqlString.Null : wmsInfo.str14);
            SetSqlString(30, wmsInfo.str15 == "" ? SqlTypes.SqlString.Null : wmsInfo.str15);
            SetSqlString(31, wmsInfo.str16 == "" ? SqlTypes.SqlString.Null : wmsInfo.str16);
            SetSqlString(32, wmsInfo.str17 == "" ? SqlTypes.SqlString.Null : wmsInfo.str17);
            SetSqlString(33, wmsInfo.str18 == "" ? SqlTypes.SqlString.Null : wmsInfo.str18);
            SetSqlString(34, wmsInfo.str19 == "" ? SqlTypes.SqlString.Null : wmsInfo.str19);
            SetSqlString(35, wmsInfo.str20 == "" ? SqlTypes.SqlString.Null : wmsInfo.str20);

            SetSqlDateTime(36, wmsInfo.DateTime1 ?? SqlTypes.SqlDateTime.Null);
            SetSqlDateTime(37, wmsInfo.DateTime2 ?? SqlTypes.SqlDateTime.Null);
            SetSqlDateTime(38, wmsInfo.DateTime3 ?? SqlTypes.SqlDateTime.Null);
            SetSqlDateTime(39, wmsInfo.DateTime4 ?? SqlTypes.SqlDateTime.Null);
            SetSqlDateTime(40, wmsInfo.DateTime5 ?? SqlTypes.SqlDateTime.Null);

            SetSqlInt32(41, wmsInfo.Int1 ?? SqlTypes.SqlInt32.Null);
            SetSqlInt32(42, wmsInfo.Int2 ?? SqlTypes.SqlInt32.Null);
            SetSqlInt32(43, wmsInfo.Int3 ?? SqlTypes.SqlInt32.Null);
            SetSqlInt32(44, wmsInfo.Int4 ?? SqlTypes.SqlInt32.Null);
            SetSqlInt32(45, wmsInfo.Int5 ?? SqlTypes.SqlInt32.Null);
            #endregion
        }
Пример #7
0
        private void GetServerClick(string clickName)
        {
            ArrayList array = this.gridHelper.GetCheckedRows();
            object    obj   = null;

            if (array.Count > 1)
            {
                WebInfoPublish.Publish(this, "只能选取一笔数据", this.languageComponent1);
                return;
            }
            if (array.Count > 0)
            {
                ArrayList objList = new ArrayList(array.Count);

                foreach (GridRecord row in array)
                {
                    obj = this.GetEditObject(row);

                    if (obj != null)
                    {
                        objList.Add(obj);
                    }
                }
                object[] asnList = ((ASN[])objList.ToArray(typeof(ASN)));
                ASN      asn     = (ASN)asnList[0];

                if (clickName == "initial")
                {
                    this.InitialObjects(asnList);
                }
                else if (clickName == "InitialCheck")
                {
                    if (asn.DirectFlag.ToUpper() == "Y")
                    {
                        WebInfoPublish.Publish(this, "该入库指令是供应商直发,不能做以下操作[初检][申请IQC]", this.languageComponent1);
                        return;
                    }
                    InitialCheckObjects(asnList);
                }
                else if (clickName == "ApplyIQC")
                {
                    if (asn.DirectFlag.ToUpper() == "Y")
                    {
                        WebInfoPublish.Publish(this, "该入库指令是供应商直发,不能做以下操作[初检][申请IQC]", this.languageComponent1);
                        return;
                    }
                    ApplyIqcObjects(asnList);
                }
                this.gridHelper.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Add);
            }
        }
Пример #8
0
        public bool CheckASNReceiveStatus(string stno)
        {
            InventoryFacade _inventoryFacade = new InventoryFacade();
            ASN             asn = (ASN)_inventoryFacade.GetASN(stno);

            if (asn != null)
            {
                return(asn.Status == "Receive");
            }
            else
            {
                return(false);
            }
        }
Пример #9
0
        public bool ASNReject(string stno)
        {
            InventoryFacade _Invenfacade = null;

            if (_Invenfacade == null)
            {
                _Invenfacade = new InventoryFacade(DataProvider);
            }
            ASN asn = (ASN)_Invenfacade.GetASN(stno);

            if (asn.Status == ASN_STATUS.ASN_ReceiveRejection)
            {
                return(true);
            }
            return(false);
        }
Пример #10
0
        //保存
        protected override void UpdateDomainObject(object domainObject)
        {
            if (_InventoryFacade == null)
            {
                _InventoryFacade = new InventoryFacade(base.DataProvider);
            }
            WarehouseFacade facade = new WarehouseFacade(base.DataProvider);

            if (_IsAdd)
            {
                #region 在invinouttrans表中增加一条数据
                ASN           asn    = (ASN)domainObject;
                DBDateTime    dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                InvInOutTrans trans  = facade.CreateNewInvInOutTrans();
                trans.CartonNO        = string.Empty;
                trans.DqMCode         = string.Empty;
                trans.FacCode         = asn.FacCode;
                trans.FromFacCode     = asn.FromFacCode;
                trans.FromStorageCode = asn.FromStorageCode;
                trans.InvNO           = asn.InvNo;
                trans.InvType         = asn.StType;
                trans.LotNo           = string.Empty;
                trans.MaintainDate    = dbTime.DBDate;
                trans.MaintainTime    = dbTime.DBTime;
                trans.MaintainUser    = this.GetUserCode();
                trans.MCode           = string.Empty;
                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     = "ASN";
                facade.AddInvInOutTrans(trans);
                #endregion
                this._InventoryFacade.AddASN((ASN)domainObject);
            }
            else
            {
                this._InventoryFacade.UpdateASN((ASN)domainObject);
            }
        }
Пример #11
0
        public void UpdateASN(string stno, int rejectQty, string rejectResult, DataTable dt)
        {
            try
            {
                InventoryFacade _inventoryFacade = new InventoryFacade(this.DataProvider);
                this.DataProvider.BeginTransaction();
                ASN asn = (ASN)_inventoryFacade.GetASN(stno);
                if (asn == null)
                {
                    throw new Exception("asn不存在!");
                }
                asn.InitRejectQty   = rejectQty;
                asn.InitReceiveDesc = rejectResult;

                foreach (DataRow dr in dt.Rows)
                {
                    ASNDetail asnDetail = (ASNDetail)_inventoryFacade.GetASNDetail(int.Parse(dr["STLINE"].ToString()), dr["STNO"].ToString());
                    if (asnDetail == null)
                    {
                        throw new Exception("不存在ASN明细!");
                    }
                    if (asnDetail.Status != ASNDetail_STATUS.ASNDetail_ReceiveClose)
                    {
                        //更新asndetail STATUS 和 InitReceiveStatus
                        asnDetail.Status            = ASNDetail_STATUS.ASNDetail_ReceiveClose;
                        asnDetail.InitReceiveStatus = SAP_LineStatus.SAP_LINE_REJECT;
                        asnDetail.InitReceiveDesc   = rejectResult;
                        _inventoryFacade.UpdateASNDetail(asnDetail);
                    }
                }

                _inventoryFacade.UpdateASN(asn);
                this.DataProvider.CommitTransaction();
            }

            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();


                BenQGuru.eMES.Common.Log.Error(ex.Message + "-------------------" + ex.Source);
                BenQGuru.eMES.Common.Log.Error(ex.StackTrace);
                throw ex;
            }
        }
Пример #12
0
        public int[] GetASN(string stno)
        {
            InventoryFacade _Invenfacade = null;

            if (_Invenfacade == null)
            {
                _Invenfacade = new InventoryFacade(DataProvider);
            }
            ASN asn = (ASN)_Invenfacade.GetASN(stno);

            int[] str = new int[3];
            if (asn != null)
            {
                str[0] = asn.InitRejectQty;
                str[1] = asn.InitReceiveQty;
                str[2] = asn.InitGiveInQty;
                return(str);
            }
            return(null);
        }
Пример #13
0
        protected override object GetEditObject()
        {
            if (_InventoryFacade == null)
            {
                _InventoryFacade = new InventoryFacade(base.DataProvider);
            }
            string stNo = FormatHelper.CleanString(this.txtStorageInASNEdit.Text, 40);
            ASN    asn  = (ASN)_InventoryFacade.GetASN(stNo);

            if (asn == null)
            {
                _IsAdd = true;
                asn    = this._InventoryFacade.CreateNewASN();
            }
            asn.StNo       = stNo;
            asn.StType     = FormatHelper.CleanString(this.drpStorageInTypeEdit.SelectedValue, 40);
            asn.InvNo      = FormatHelper.CleanString(this.txtSAPInvNoEdit.Text, 40);
            asn.PreictDate = FormatHelper.TODateInt(this.txtExpectedArrivalDateEdit.Text);



            asn.DirectFlag  = this.cblFlag.Items[0].Selected ? "Y" : "";
            asn.RejectsFlag = this.cblFlag.Items[1].Selected ? "Y" : "";
            asn.Remark1     = FormatHelper.CleanString(this.txtMemoEdit.Text, 300);
            asn.VendorCode  = FormatHelper.CleanString(this.drpVendorCodeEdit.SelectedValue, 40);
            if (_IsAdd)
            {
                asn.Status      = ASNLineStatus.Release;
                asn.FacCode     = this.GetFacCode();
                asn.StorageCode = FormatHelper.CleanString(this.drpStorageInEdit.Text, 40);
                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider);
                asn.CDate = dbDateTime.DBDate;
                asn.CTime = dbDateTime.DBTime;
                asn.CUser = this.GetUserCode();
            }
            asn.MaintainUser = this.GetUserCode();

            return(asn);
        }
Пример #14
0
        private bool ValidateInputForCreateIQCByASN()
        {
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new LengthCheck(lblReceiptNOEdit, txtASNEdit, 40, true));

            if (!manager.Check())
            {
                WebInfoPublish.PublishInfo(this, manager.CheckMessage, languageComponent1);
                return(false);
            }

            ASN asn = (ASN)_IQCFacade.GetASN(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtASNEdit.Text)));

            if (asn != null)
            {
                WebInfoPublish.PublishInfo(this, "$Error_ReceiptNOHasBeenDealed", languageComponent1);
                return(false);
            }

            return(true);
        }
Пример #15
0
        private bool IQCReceive(MaterialReceive materialReceive, ref string returnMessage)
        {
            bool returnValue = false;

            if (materialReceive != null)
            {
                bool checkPassed = true;
                if (this._IQCFacade.IsFromASN(materialReceive.STNo))
                {
                    ASN asn = (ASN)this._IQCFacade.GetASN(materialReceive.STNo);
                    //asn单为Release不能接受
                    if (asn == null || (asn.STStatus != IQCStatus.IQCStatus_WaitCheck && asn.STStatus != IQCStatus.IQCStatus_Close))
                    {
                        checkPassed = false;
                    }
                }

                if (checkPassed)
                {
                    materialReceive.Flag         = FlagStatus.FlagStatus_MES;
                    materialReceive.MaintainUser = this.GetUserCode();

                    returnValue = this._IQCFacade.IQCReceiveMaterial((MaterialReceive)materialReceive);
                }
                else
                {
                    returnMessage = "$Message_ASNIsNotWaitCheckOrCancel";
                }
            }

            if (returnValue)
            {
                returnMessage = string.Empty;
            }
            return(returnValue);
        }
Пример #16
0
        public string RejectDetail(DataTable dt, string stno, string rejectResult, string rejectCount)
        {
            InventoryFacade _InventoryFacade = new InventoryFacade(DataProvider);

            if (dt.Rows.Count == 0)
            {
                return(stno + "无数据!");
            }
            if (string.IsNullOrEmpty(rejectResult))
            {
                return("拒收时必须填写拒收数量和选择拒收原因!");
            }

            int rejectNum = 0;

            if (!int.TryParse(rejectCount, out rejectNum))
            {
                return("拒收数量必须是数字!");
            }

            ASN asn = (ASN)_InventoryFacade.GetASN(stno);

            if (asn == null)
            {
                return(stno + "入库指令号不存在!");
            }

            if (asn.StType == InInvType.PGIR)
            {
                if (rejectNum != dt.Rows.Count)
                {
                    return("生产退料只能全部拒收!");
                }
            }



            this.DataProvider.BeginTransaction();
            try
            {
                //统计已经初检完成的行数
                int       count     = 0;
                ASNDetail asnDetail = null;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string stLine = dt.Rows[i][2].ToString();

                    asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);
                    if (asnDetail.Status == ASNDetail_STATUS.ASNDetail_ReceiveClose)
                    {
                        count++;
                    }
                }

                //如果拒收数量等于剩余待检行数量,表示剩余全部拒收
                if (rejectNum == dt.Rows.Count - count)
                {
                    string message = string.Empty;
                    if (!AllReject(dt, stno, rejectResult, out message))
                    {
                        return(message);
                    }
                }
                else if (rejectNum < dt.Rows.Count - count)//否则部分拒收
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string stLine = dt.Rows[i][2].ToString();
                        asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);

                        asnDetail.InitReceiveDesc = rejectResult;
                        _InventoryFacade.UpdateASNDetail(asnDetail);
                    }


                    //更新主表初检拒收数量和拒收描述

                    asn.InitRejectQty   = rejectNum;
                    asn.InitReceiveDesc = rejectResult;
                    _InventoryFacade.UpdateASN(asn);
                }
                else
                {
                    return("拒收数量不能大于剩余待检行记录数");
                }

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }

            return("拒收成功!");
        }
Пример #17
0
        protected void InitialObjects(object[] asnList)
        {
            //1>	入库指令号状态为:WaitReceive:待收货,则修改入库指令号(TBLASN、TBLASNDETAIL)状态为:Release:初始化
            //2>	入库指令号状态不为:WaitReceive:待收货,则报错提示当前入库指令号不能取消下发

            try
            {
                InventoryFacade facade = new InventoryFacade(base.DataProvider);

                WarehouseFacade _wa = new WarehouseFacade(DataProvider);
                //foreach (ASN asn in asnList)
                // {
                ASN asn = (ASN)asnList[0];

                if (asn.Status != "Release" && asn.Status != "Receive" && asn.Status != "WaitReceive")
                {
                    WebInfoPublish.Publish(this, asn.StNo + "入库指令号不能取消下发,状态必须是到货初检中才能取消下发", this.languageComponent1);
                    return;
                }

                this.DataProvider.BeginTransaction();

                _wa.UpdateASNForCancelDown(new string[] { asn.StNo }, "Release");

                facade.UpdateASNDetail(asn.StNo, ASNHeadStatus.Release);
                facade.UpdateASNDetailSN(asn.StNo);
                //facade.UpdateASNDetailItem(asn.StNo);


                DBDateTime dbTime1 = FormatHelper.GetNowDBDateTime(this.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    = this.GetUserCode();
                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     = "CANCELISSUE";
                _wa.AddInvInOutTrans(trans);


                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
        }
Пример #18
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);
            }
        }
Пример #19
0
        public string GiveinDetail(DataTable dt, string stno, string giveinResult)
        {
            InventoryFacade _InventoryFacade = new InventoryFacade(this.DataProvider);


            WarehouseFacade _WarehouseFacade = new WarehouseFacade(this.DataProvider);

            if (string.IsNullOrEmpty(giveinResult))
            {
                return("让步接收时必须填写原因");
            }


            if (dt.Rows.Count == 0)
            {
                return(stno + "无数据");
            }


            bool      isGivein  = false;
            ASNDetail asnDetail = null;

            try
            {
                ASN asn = (ASN)_InventoryFacade.GetASN(stno.Trim().ToUpper());


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()) && dt.Rows[i][0].ToString() != "√")
                    {
                        continue;
                    }

                    string stLine = dt.Rows[i][2].ToString();

                    ASNDetail asnDetail1 = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);


                    if (string.IsNullOrEmpty(asnDetail1.CartonNo))
                    {
                        return("让步接收必须填写箱号!");
                    }

                    if (!_WarehouseFacade.CheckAlterIncludeEQ(asn.InvNo, asnDetail1.DQMCode))
                    {
                        return(asn.InvNo + ":" + ":" + asnDetail.DQMCode + "数量已超出SAP计划数量!");
                    }
                }
                this.DataProvider.BeginTransaction();
                //算出剩余要接收的数量(入库指令行记录数减去拒收数量)

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()) && dt.Rows[i][0].ToString() != "√")
                    {
                        continue;
                    }

                    string stLine = dt.Rows[i][2].ToString();
                    asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);

                    asn = (ASN)_InventoryFacade.GetASN(stno);

                    if (asnDetail.Status != ASNDetail_STATUS.ASNDetail_ReceiveClose)
                    {
                        asnDetail.InitReceiveStatus = SAP_LineStatus.SAP_LINE_GIVEIN;
                        asnDetail.ReceiveQty        = asnDetail.Qty;
                        asnDetail.Status            = ASNDetail_STATUS.ASNDetail_ReceiveClose;
                        asnDetail.InitGIVEINDESC    = giveinResult;


                        _InventoryFacade.UpdateASNDetail(asnDetail);

                        //接收数量(TBLASNDETAILITEM.ReceiveQTY)更新为:等于需求数量(TBLASNDETAILITEM.QTY)
                        _InventoryFacade.UpdateASNItem(stno, stLine);

                        asn.InitGiveInQty += 1;
                        _InventoryFacade.UpdateASN(asn);
                        isGivein = true;
                    }
                }
                this.DataProvider.CommitTransaction();
                if (isGivein)
                {
                    return("让步接收成功!");
                }
                return("让步接收失败没有条目需要让步接收!");
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                ;
                throw ex;
            }
        }
Пример #20
0
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();
            //row["ASN"] = ((ASN)obj).StNo;
            //row["CDate"] = FormatHelper.ToDateString(((ASN)obj).CDate);
            //row["CUser"] = ((ASN)obj).CUser;
            //row["StorageInType"] =this.GetInvInName(((ASN)obj).StType);
            //row["SAPInvNo"] = ((ASN)obj).InvNo;
            //row["Status"] = this.GetStatusName(((ASN)obj).Status);
            //row["StorageInCode"] = ((ASN)obj).StorageCode;
            //row["PredictDate"] = FormatHelper.ToDateString(((ASN)obj).PreictDate);
            //row["DirectFlag"] = ((ASN)obj).DirectFlag;
            //row["PickNo"] = ((ASN)obj).PickNo;
            //row["VendorCode"] = ((ASN)obj).VendorCode;
            //row["ExigencyFlag"] = ((ASN)obj).ExigencyFlag;
            //row["RejectsFlag"] = ((ASN)obj).RejectsFlag;
            //row["OANo"] = ((ASN)obj).OANo;
            //row["PackingListNo"] = ((ASN)obj).PackingListNo;
            //row["ProvideDate"] = FormatHelper.ToDateString(((ASN)obj).ProvideDate);
            //row["GrossWeight"] = ((ASN)obj).GrossWeight;
            //row["Volume"] = ((ASN)obj).Volume;
            //row["FromStorageCode"] = ((ASN)obj).FromStorageCode;
            //row["Remark1"] = ((ASN)obj).Remark1;
            ASN  inv  = obj as ASN;
            Type type = inv.GetType();

            if (this.SAPHeadViewFieldList.Length > 6)
            {
                for (int i = 0; i < 6; i++)
                {
                    ViewField field    = this.SAPHeadViewFieldList[i];
                    string    strValue = string.Empty;
                    System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                    if (fieldInfo != null)
                    {
                        strValue = fieldInfo.GetValue(inv).ToString();
                    }
                    if (field.FieldName == "CDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.CDate);
                    }
                    else if (field.FieldName == "StType")
                    {
                        strValue = this.GetInvInName(inv.StType);
                    }
                    else if (field.FieldName == "StorageInType")
                    {
                        strValue = this.GetInvInName(inv.StType);
                    }
                    else if (field.FieldName == "Status")
                    {
                        strValue = this.GetStatusName(inv.Status);
                    }
                    else if (field.FieldName == "PredictDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.PreictDate);
                    }
                    else if (field.FieldName == "ProvideDate")
                    {
                        strValue = inv.ProvideDate;// FormatHelper.ToDateString(inv.ProvideDate);
                    }

                    //PlanSendDate
                    row[i + 1] = strValue;
                }
                for (int i = 6; i < this.SAPHeadViewFieldList.Length; i++)
                {
                    ViewField field    = this.SAPHeadViewFieldList[i];
                    string    strValue = string.Empty;
                    System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                    if (fieldInfo != null)
                    {
                        strValue = fieldInfo.GetValue(inv).ToString();
                    }
                    else if (field.FieldName == "StType")
                    {
                        strValue = this.GetInvInName(inv.StType);
                    }
                    if (field.FieldName == "CDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.CDate);
                    }
                    else if (field.FieldName == "StorageInType")
                    {
                        strValue = this.GetInvInName(inv.StType);
                    }
                    else if (field.FieldName == "Status")
                    {
                        strValue = this.GetStatusName(inv.Status);
                    }
                    else if (field.FieldName == "PredictDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.PreictDate);
                    }
                    else if (field.FieldName == "ProvideDate")
                    {
                        strValue = inv.ProvideDate;//  FormatHelper.ToDateString(inv.ProvideDate);
                    }

                    //PlanSendDate
                    row[i + 4] = strValue;
                }
            }
            else
            {
                for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
                {
                    ViewField field    = this.SAPHeadViewFieldList[i];
                    string    strValue = string.Empty;
                    System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                    if (fieldInfo != null)
                    {
                        strValue = fieldInfo.GetValue(inv).ToString();
                    }
                    if (field.FieldName == "CDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.CDate);
                    }
                    else if (field.FieldName == "StorageInType")
                    {
                        strValue = this.GetInvInName(inv.StType);
                    }
                    else if (field.FieldName == "Status")
                    {
                        strValue = this.GetStatusName(inv.Status);
                    }
                    else if (field.FieldName == "PredictDate")
                    {
                        strValue = FormatHelper.ToDateString(inv.PreictDate);
                    }
                    else if (field.FieldName == "ProvideDate")
                    {
                        strValue = inv.ProvideDate;// FormatHelper.ToDateString(inv.ProvideDate);
                    }
                    else if (field.FieldName == "FacName")
                    {
                        strValue = inv.ProvideDate;// FormatHelper.ToDateString(inv.ProvideDate);
                    }
                    //PlanSendDate
                    row[i + 1] = strValue;
                }
            }

            return(row);
        }
Пример #21
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);
                }
            }
        }
Пример #22
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;
            }
        }
Пример #23
0
        protected bool AllReject(DataTable dt, string stno, string rejectReason, out string message)
        {
            WarehouseFacade _WarehouseFacade = new WarehouseFacade(DataProvider);
            InventoryFacade _InventoryFacade = new InventoryFacade(DataProvider);

            message = string.Empty;
            ASNDetail asnDetail = null;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string stLine = dt.Rows[i][2].ToString();
                asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);
                //检查剩余待检的是否已全部勾选
                if (asnDetail.Status != ASNDetail_STATUS.ASNDetail_ReceiveClose)
                {
                    if (!string.IsNullOrEmpty(asnDetail.CartonNo))
                    {
                        message = "已有行数据关联箱号,不能拒收";
                        return(false);
                    }
                }
            }

            ASN asn = (ASN)_InventoryFacade.GetASN(stno.Trim().ToUpper());

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string stLine = dt.Rows[i][2].ToString();
                asnDetail = (ASNDetail)_InventoryFacade.GetASNDetail(int.Parse(stLine), stno);
                if (asnDetail.Status != ASNDetail_STATUS.ASNDetail_ReceiveClose)
                {
                    //更新asndetail STATUS 和 InitReceiveStatus

                    asnDetail.InitReceiveStatus = SAP_LineStatus.SAP_LINE_REJECT;

                    asnDetail.InitReceiveDesc = rejectReason;
                    _InventoryFacade.UpdateASNDetail(asnDetail);

                    object[] objs_item = _WarehouseFacade.GetASNDetailItembyStnoAndStline(asnDetail.StNo, asnDetail.StLine);
                    if (objs_item != null)
                    {
                        foreach (Asndetailitem item in objs_item)
                        {
                            item.ReceiveQty = 0;
                            item.QcpassQty  = 0;
                            item.ActQty     = 0;
                            _WarehouseFacade.UpdateAsndetailitem(item);
                        }
                    }
                }
            }


            asn.Status          = ASN_STATUS.ASN_ReceiveRejection;
            asn.InitRejectQty   = dt.Rows.Count;
            asn.InitReceiveDesc = rejectReason;
            _InventoryFacade.UpdateASN(asn);
            message = "拒收成功!";

            return(true);
        }