示例#1
0
        private String SN;                                 //序列号
        #endregion

        private void btnSave_Press(object sender, EventArgs e)
        {
            try
            {
                if (btnDealMan.Tag == null)
                {
                    throw new Exception("处理人不能为空");
                }
                else
                {
                    ScrapData.SCRAPMAN = btnDealMan.Tag.ToString();          //处理人
                }
                ScrapData.SCRAPDATE   = DatePicker.Value;                    //业务日期
                ScrapData.NOTE        = txtNote.Text;                        //备注
                ScrapData.STATUS      = 0;                                   //维修单状态
                ScrapData.ISSNCONTROL = (Int32)ISSNCONTROL.启用;               //是否属于SN
                ScrapData.CREATEUSER  = Client.Session["UserID"].ToString(); //创建用户
                ScrapData.CREATEDATE  = DateTime.Now;

                List <AssScrapOrderRow> Data = new List <AssScrapOrderRow>();
                if (ListAssetsSN.Rows.Count == 0)
                {
                    throw new Exception("报废行项不能为空!");
                }
                foreach (ListViewRow Row in ListAssetsSN.Rows)
                {
                    frmOrderCreateSNLayout Layout  = Row.Control as frmOrderCreateSNLayout;
                    AssetsOrderRow         RowData = Layout.getData();
                    AssScrapOrderRow       assRow  = new AssScrapOrderRow();

                    assRow.IMAGE      = RowData.IMAGE;
                    assRow.ASSID      = RowData.ASSID;
                    assRow.SN         = RowData.SN;
                    assRow.SCRAPQTY   = RowData.QTY;
                    assRow.LOCATIONID = RowData.LOCATIONID;
                    assRow.STATUS     = RowData.STATUS;
                    assRow.CREATEDATE = DateTime.Now;
                    Data.Add(assRow);
                }
                ScrapData.Rows = Data;
                ReturnInfo r = autofacConfig.assScrapOrderService.AddAssScrapOrder(ScrapData);
                if (r.IsSuccess)
                {
                    ShowResult = ShowResult.Yes;
                    Form.Close();          //创建成功
                    Toast("创建报废单成功!");
                }
                else
                {
                    throw new Exception(r.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// 更新报废单行项
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public ReturnInfo UpdateAssScrapOrderRow(SOInputDto entity)
        {
            ReturnInfo RInfo = new ReturnInfo();

            try
            {
                AssScrapOrderRow assROR   = new AssScrapOrderRow();
                AssQuant         assQuant = new AssQuant();
                foreach (AssScrapOrderRow Row in entity.Rows)
                {
                    assROR = _AssScrapOrderRowRepository.GetByID(entity.SOID, Row.SOROWID).FirstOrDefault();
                    if (assROR == null)
                    {
                        throw new Exception("报废单行项:" + Row.SOROWID + "不存在!");
                    }
                    assROR.SCRAPQTY = assROR.SCRAPQTY - Convert.ToDecimal(Row.RETURNQTY);     //报废数量
                    if (Row.SCRAPQTY < 0)
                    {
                        throw new Exception("还原数量不能超过报废总数");
                    }
                    assROR.RETURNQTY = Convert.ToDecimal(assROR.RETURNQTY) + Row.RETURNQTY;
                    if (assROR.SCRAPQTY == 0)       //如果全部维修完毕,则修改行项状态
                    {
                        assROR.STATUS = 1;
                    }

                    //更新OrderRow数据
                    _unitOfWork.RegisterDirty(assROR);
                    //往AssProcessRecord表添加数据
                    CreateSR(entity, Row, PROCESSMODE.报废还原);

                    Assets assetsSN = _AssetsRepository.GetByID(Row.ASSID).FirstOrDefault();
                    if (assetsSN == null)
                    {
                        throw new Exception("不存在条码为:" + Row.ASSID + "的资产!");
                    }

                    assetsSN.STATUS = (Int32)STATUS.闲置;
                    _unitOfWork.RegisterDirty(assetsSN);
                }
                RInfo.IsSuccess = true;
                RInfo.ErrorInfo = "维修单行项更新成功!";
            }
            catch (Exception ex)
            {
                _unitOfWork.Rollback();
                RInfo.IsSuccess = false;
                RInfo.ErrorInfo = ex.Message;
            }
            return(RInfo);
        }
示例#3
0
 /// <summary>
 /// 获取行项数据
 /// </summary>
 /// <returns></returns>
 public AssScrapOrderRow getData()
 {
     if (Check.Checked)
     {
         AssScrapOrderRow Data = new AssScrapOrderRow();
         Data.SOROWID   = Check.BindDataValue.ToString();
         Data.IMAGE     = imgAss.BindDisplayValue.ToString();
         Data.ASSID     = lblName.BindDataValue.ToString();
         Data.SN        = lblSN.BindDataValue.ToString();
         Data.RETURNQTY = 1;
         Data.STATUS    = 1;
         return(Data);
     }
     else
     {
         return(null);
     }
 }
示例#4
0
        /// <summary>
        /// 创建ProcessRecorder表数据
        /// </summary>
        /// <param name="Data"></param>
        /// <param name="RowData"></param>
        /// <param name="Type"></param>
        public void CreateSR(SOInputDto Data, AssScrapOrderRow RowData, PROCESSMODE Type)
        {
            AssProcessRecord assProcessRecord = new AssProcessRecord
            {
                ASSID      = RowData.ASSID,     //资产条码
                CREATEDATE = DateTime.Now,      //创建时间
                CREATEUSER = Data.CREATEUSER,   //创建用户
                HANDLEDATE = DateTime.Now,      //处理时间
                MODIFYDATE = DateTime.Now,      //修改时间
                MODIFYUSER = Data.MODIFYUSER,   //修改用户
            };

            switch (Type)
            {
            case PROCESSMODE.清理报废:
                assProcessRecord.QUANTITY    = RowData.SCRAPQTY;
                assProcessRecord.PROCESSMODE = (Int32)PROCESSMODE.清理报废;
                assProcessRecord.HANDLEMAN   = Data.CREATEUSER;
                break;

            case PROCESSMODE.报废还原:
                assProcessRecord.QUANTITY    = RowData.SCRAPQTY;
                assProcessRecord.PROCESSMODE = (Int32)PROCESSMODE.报废还原;
                assProcessRecord.HANDLEMAN   = Data.MODIFYUSER;
                break;
            }
            assProcessRecord.ASSID = RowData.ASSID;
            switch (Type)         //根据操作模式,输入操作内容
            {
            case PROCESSMODE.清理报废:
                assProcessRecord.PROCESSCONTENT = Data.CREATEUSER + "报废了物品编号为" + RowData.ASSID + "的资产";
                break;

            case PROCESSMODE.报废还原:
                assProcessRecord.PROCESSCONTENT = Data.CREATEUSER + "还原了物品编号为" + RowData.ASSID + "的资产";
                break;
            }
            _unitOfWork.RegisterNew(assProcessRecord);
        }