Exemplo n.º 1
0
        public void UpdateAssignLog(AssignDetail detail, OperLog operLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
//
//					AssignDetail detail = new AssignDetail();
//					detail.cnnAssignSerialNo = detailLog.cnnAssignSerialNo;
//					detail.cnnOrderSerialNo = detailLog.cnnOrderSerialNo;
//					detail.cnvcProductCode = detailLog.cnvcProductCode;
                    AssignDetail detailOld = EntityMapping.Get(detail, trans) as AssignDetail;
                    if (detail.cnnCount != detailOld.cnnCount)
                    {
                        string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                        DateTime dtSysTime  = DateTime.Parse(strSysTime);

                        OrderSerialNo serialNo = new OrderSerialNo();
                        serialNo.cnvcFill    = "0";
                        serialNo.cnnSerialNo = Convert.ToDecimal(EntityMapping.Create(serialNo, trans));

                        detailOld.cnnCount = detail.cnnCount;
                        detailOld.cnnSum   = Math.Round(detail.cnnCount * detailOld.cnnPrice, 2);
                        EntityMapping.Update(detailOld, trans);

                        AssignDetailLog detailLog = new AssignDetailLog(detailOld.ToTable());
                        detailLog.cnvcOperID  = operLog.cnvcOperID;
                        detailLog.cndOperDate = dtSysTime;
                        detailLog.cnnSerialNo = serialNo.cnnSerialNo;
                        EntityMapping.Create(detailLog, trans);

                        operLog.cndOperDate  = dtSysTime;
                        operLog.cnvcComments = "生产流水:" + detail.cnnAssignSerialNo.ToString() + ",日志流水:" + serialNo.cnnSerialNo.ToString();
                        EntityMapping.Create(operLog, trans);
                    }


                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 2
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                Dept dept = new Dept();
                dept.cnvcDeptID = e.Item.Cells[0].Text;
                string strPriority = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
                if (!this.JudgeIsNum(strPriority, "优先级"))
                {
                    return;
                }
                dept.cnnPriority = Convert.ToInt32(strPriority);
                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整部门优先级";

                GoodsFacade gf = new GoodsFacade();
                gf.UpdatePriority(dept, operLog);
                Popup("修改成功");
                this.DataGrid1.EditItemIndex = -1;
                BindGrid();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            try
            {
                DataTable   dtOrderReduce    = (DataTable)Session["ProductList"];
                OrderFacade order            = new OrderFacade();
                string      strOrderSerialNo = txtOrderSerialNo.Text;
                OperLog     operLog          = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "减单";

                order.OrderReduce(strOrderSerialNo, ddlReduceType.SelectedValue, txtReduceComments.Text, dtOrderReduce, operLog);
                Session["ProductList"] = null;
                btnCancel_Click(null, null);
                btnOK.Visible = false;
                Popup("减单成功");

                DataTable dtOrderBookDetail = (DataTable)Session["ProductList"];
                this.DataGrid2.DataSource = dtOrderBookDetail;
                this.DataGrid2.DataBind();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void btnLinkOrder_Click(object sender, System.EventArgs e)
        {
            //关联订单
            try
            {
                ProduceLog pLog = new ProduceLog();
                pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
                pLog.cndProduceDate     = DateTime.Parse(txtProduceDate.Text);
                pLog.cndShipBeginDate   = DateTime.Parse(txtShipBeginDate.Text);
                pLog.cndShipEndDate     = DateTime.Parse(txtShipEndDate.Text);
                pLog.cnvcProduceDeptID  = ddlProduceDept.SelectedValue;
                pLog.cnvcOperID         = oper.strLoginID;

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "关联订单";



                ProduceFacade pFacade = new ProduceFacade();
                pFacade.LindOrder(pLog, operLog);
                Popup("关联订单成功");
                btnQueryProduct_Click(null, null);
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 5
0
 public void Update(OperLog operLog)
 {
     Update(new List <OperLog>()
     {
         operLog
     });
 }
Exemplo n.º 6
0
        private void Button2_Click(object sender, System.EventArgs e)
        {
            //生产产品入库
            DataTable dtSalesSerial = GetProduct();
            ArrayList alSalesSerial = new ArrayList();

            if (dtSalesSerial.Rows.Count > 0)
            {
                foreach (DataRow dr in dtSalesSerial.Rows)
                {
                    SalesSerial ps = new SalesSerial(dr);
                    ps.cndCreateDate = Convert.ToDateTime(TextBox1.Text);
                    ps.cnvcOperID    = oper.strLoginID;
                    ps.cnvcDeptID    = ddlDept.SelectedValue;

                    alSalesSerial.Add(ps);
                }

                OperLog ol = new OperLog();
                ol.cnvcDeptID   = oper.strDeptID;
                ol.cnvcOperID   = oper.strLoginID;
                ol.cnvcOperType = "销售产品入库";

                ProductFacade pf = new ProductFacade();
                pf.AddSalesSerial(alSalesSerial, ol);

                this.Popup("销售产品入库成功!");

                //清理数据

                Session.Remove("tbSalesSerial");
                BindGrid();
            }
        }
        private void btnModify_Click(object sender, System.EventArgs e)
        {
            //修改
            try
            {
                OrderBook order = new OrderBook();
                order.cnvcOperID        = oper.strLoginID;
                order.cnvcOrderType     = ddlOrderType.SelectedValue;
                order.cnvcProduceDeptID = ddlProduceDept.SelectedValue;
                order.cnvcOrderDeptID   = ddlSalesRoom.SelectedValue;

                if (order.cnvcOrderType == "WDO")
                {
                    order.cndArrivedDate  = DateTime.Parse(txtArrivedDate.Text);
                    order.cnvcLinkPhone   = txtLinkPhone.Text;
                    order.cnvcShipAddress = txtShipAddress.Text;
                    order.cnvcCustomName  = txtCustomName.Text;
                }
                order.cnnOrderSerialNo = decimal.Parse(txtOrderSerialNo.Text);
                order.cndShipDate      = DateTime.Parse(txtShipDate.Text);

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "修改订单";

                OrderFacade orderFacade = new OrderFacade();
                orderFacade.UpdateOrder(order, operLog);
                Popup("修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 8
0
        public void UpdateOrder(OrderBook order, OperLog operLog)       //,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    OrderBook oldOrder = new OrderBook();
                    oldOrder.cnnOrderSerialNo = order.cnnOrderSerialNo;
                    oldOrder = EntityMapping.Get(oldOrder, trans) as OrderBook;
                    if (oldOrder == null)
                    {
                        throw new Exception("订单未找到");
                    }
                    oldOrder.cnvcOrderOperID   = order.cnvcOrderOperID;
                    oldOrder.cnvcOrderType     = order.cnvcOrderType;
                    oldOrder.cnvcProduceDeptID = order.cnvcProduceDeptID;
                    oldOrder.cnvcOrderDeptID   = order.cnvcOrderDeptID;

                    if (oldOrder.cnvcOrderType == "WDO")
                    {
                        oldOrder.cndArrivedDate  = order.cndArrivedDate;
                        oldOrder.cnvcLinkPhone   = order.cnvcLinkPhone;
                        oldOrder.cnvcShipAddress = order.cnvcShipAddress;
                        oldOrder.cnvcCustomName  = order.cnvcCustomName;
                    }
                    //order.cnnOrderSerialNo = decimal.Parse(txtOrderSerialNo.Text);
                    oldOrder.cndShipDate = order.cndShipDate;
                    EntityMapping.Update(oldOrder, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "订单流水:" + oldOrder.cnnOrderSerialNo;
                    EntityMapping.Create(operLog, trans);

                    //EntityMapping.Create(busiLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
        private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DataGridItem item     = this.DataGrid1.SelectedItem;
            string       strAssID = item.Cells[0].Text.Trim();
            OperLog      operLog  = new OperLog();

            operLog.cnvcOperType = "添加关联分货单";
            operLog.cnvcOperID   = this.oper.strLoginID;
            operLog.cnvcDeptID   = this.oper.strDeptID;
            StorageFacade sto = new StorageFacade();
            int           ret = sto.AddDeptStorageEnterDetail(operLog, this.txtRdID.Text.Trim(), strAssID, this.ddlDept.SelectedValue);

            if (ret > 0)
            {
                this.Popup("添加关联分货单成功!");
            }
            else
            {
                this.Popup("添加关联分货单失败!");
            }

            this.DataGrid1.DataSource = null;
            this.DataGrid1.DataBind();
            this.DBBind();
        }
        private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DataGridItem item      = this.DataGrid1.SelectedItem;
            string       strselsql = "select " + this.txtRdID.Text.Trim() + ",'" + item.Cells[1].Text.Trim() + "'," + item.Cells[0].Text.Trim() + ",cnvcProviderID,cnvcInvCode,0,cnnPrice,0,0,cnvcGroupCode,cnvcComunitCode,cnvcBatch,'0','',cndMdate,cnnMassDate,cnvcMassUnit,cndExpDate";

            strselsql += " from tbRdRecordDetail where cnnAutoID=" + item.Cells[0].Text.Trim() + " and cnvcPoID='" + item.Cells[1].Text.Trim() + "' and cnvcProviderID='" + item.Cells[4].Text.Trim() + "' and cnvcInvCode='" + item.Cells[6].Text.Trim() + "'";
            OperLog operLog = new OperLog();

            operLog.cnvcOperType = "添加采购退货品";
            operLog.cnvcOperID   = this.oper.strLoginID;
            operLog.cnvcDeptID   = this.oper.strDeptID;
            StorageFacade sto = new StorageFacade();
            int           ret = sto.AddPoStockReturnDetail(operLog, strselsql);

            if (ret > 0)
            {
                this.Popup("添加退货品成功!");
            }
            else
            {
                this.Popup("添加退货品失败!");
            }

            this.DataGrid1.DataSource = null;
            this.DataGrid1.DataBind();
            this.DBBind();
        }
Exemplo n.º 11
0
        private void btnClearDivideGoods_Click(object sender, System.EventArgs e)
        {
            //清除分货数据
            try
            {
                //string strwhhouse = this.ddlWarehouse.SelectedValue;
                ProduceLog pLog = new ProduceLog();
                pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
                pLog.cnvcOperID         = oper.strLoginID;

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "清除分货数据";

                GoodsFacade goods = new GoodsFacade();
                goods.DeleteAssignLog(pLog, operLog);
                BindAssignLog(txtProduceSerialNo.Text);
                Popup("清除分货数据成功");
                this.btnQuery_Click(null, null);
                //this.btnDivideGoods.Enabled = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 12
0
        private void btnClear_Click(object sender, System.EventArgs e)
        {
            //清除预估数据
//			ProduceLog pLog = new ProduceLog();
//			pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
//			pLog.cnvcOperID = oper.strLoginID;

            OperLog operLog = new OperLog();

            operLog.cnvcOperID   = oper.strLoginID;
            operLog.cnvcDeptID   = oper.strDeptID;
            operLog.cnvcOperType = "清除预估数据";
            ProduceFacade pf = new ProduceFacade();

            try
            {
                pf.ClearMake(txtProduceSerialNo.Text, operLog);
                Popup("清除预估数据成功");
                this.DataGrid1.DataSource = null;
                this.DataGrid1.DataBind();
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
Exemplo n.º 13
0
        private void Button1_Click(object sender, System.EventArgs e)
        {
            //预估调整
            try
            {
                string  strProduceSerialNo = this.txtProduceSerialNo.Text;
                OperLog ol = new OperLog();
                ol.cnvcOperID   = this.oper.strLoginID;
                ol.cnvcDeptID   = this.oper.strDeptID;
                ol.cnvcOperType = "调整预估";
                //AdjustMakeDetail

                ProduceFacade pf = new ProduceFacade();
                if (this.chkSelf.Checked)
                {
                    pf.AdjustMakeDetailSelf(strProduceSerialNo, ol);
                }
                else
                {
                    pf.AdjustMakeDetail(strProduceSerialNo, ol);
                }
                this.Popup("调整预估成功");
                BindGrid();
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
Exemplo n.º 14
0
        private void btnMakeLog_Click(object sender, System.EventArgs e)
        {
            try
            {
                ProduceLog pLog = new ProduceLog();
                pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
                pLog.cnvcOperID         = oper.strLoginID;

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "生产预估";
                ProduceFacade pf = new ProduceFacade();
                if (chkSelf.Checked)
                {
                    pf.AddMakeLogSelf(pLog, operLog);
                }
                else
                {
                    pf.AddMakeLog(pLog, operLog);
                }
                Popup("预估成功");
                BindGrid();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 15
0
 public void Insert(OperLog operLog)
 {
     Insert(new List <OperLog>()
     {
         operLog
     });
 }
Exemplo n.º 16
0
        private void DataGrid2_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            //更新计划生产数量
            try
            {
                OperLog ol = new OperLog();
                ol.cnvcOperType = "更新计划生产数量";
                ol.cnvcOperID   = this.oper.strLoginID;
                ol.cnvcDeptID   = this.oper.strDeptID;

                ProduceDetail pd = new ProduceDetail();
                pd.cnnProduceSerialNo = Convert.ToDecimal(this.txtProduceSerialNo.Text);
                pd.cnvcInvCode        = e.Item.Cells[0].Text;
                pd.cnnProduceCount    = Convert.ToDecimal(((TextBox)e.Item.Cells[6].Controls[0]).Text);
                ProduceFacade pf = new ProduceFacade();
                pf.UpdateProduceDetail(pd, ol);
                this.DataGrid2.EditItemIndex = -1;
                btnQueryProduct_Click(null, null);
                this.Popup("成功更新计划生产数量");
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
Exemplo n.º 17
0
        protected void btnCheck_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (Session["tbProduceDetail"] == null)
                {
                    throw new Exception("请首先使用【计划查询】按钮,查询计划情况");
                }
                DataTable   dtProduce = (DataTable)Session["tbProduceDetail"];
                GoodsFacade gf        = new GoodsFacade();
                OperLog     operLog   = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "盘点入库";
                gf.ProduceCheck(dtProduce, operLog, ddlProduceDept.SelectedValue, txtProduceSerialNo.Text);
                Popup("盘点完成");
                //this.btnCheck.Enabled = false;
                this.DataGrid1.DataSource = null;
                this.DataGrid1.DataBind();
                Session["tbProduceDetail"] = null;

                this.bntEdit.Visible        = false;
                this.btnEndEdit.Visible     = false;
                this.btnEditConfirm.Visible = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 18
0
        public void UpdateBook(Book book, OperLog operLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    Entity.Book oldbook = new Book();
                    oldbook.cnnSerialNo = book.cnnSerialNo;
                    oldbook             = EntityMapping.Get(oldbook, trans) as Book;
                    if (oldbook == null)
                    {
                        throw new Exception("未找到留言内容!");
                    }
                    if (oldbook.cnvcState != "0")
                    {
                        throw new Exception("已确认的留言不能修改!");
                    }
                    oldbook.cnvcBook        = book.cnvcBook;
                    oldbook.cmvcPublishID   = book.cmvcPublishID;
                    oldbook.cnvcPublishName = book.cnvcPublishName;
                    oldbook.cndPublishDate  = dtSysTime;
                    oldbook.cnvcCheckDept   = book.cnvcCheckDept;

                    oldbook.cnvcCheckID   = string.Empty;
                    oldbook.cnvcCheckName = string.Empty;
                    oldbook.cndcheckDate  = DateTime.MinValue;

                    EntityMapping.Update(oldbook, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "留言本流水号:" + oldbook.cnnSerialNo.ToString();
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 19
0
        protected void btnEditConfirm_Click(object sender, System.EventArgs e)
        {
            try
            {
                //				if(txtProduceState.Text == "4")
                //				{
                //					throw new Exception("此订单已运输,不能修改分货量");
                //				}
                ArrayList alDetail = new ArrayList();
                foreach (DataGridItem dgi in this.DataGrid2.Items)
                {
                    string strCount = ((TextBox)dgi.Cells[11].Controls[1]).Text;
                    if (this.JudgeIsNull(strCount))
                    {
                        throw new Exception("请输入盘点量");
                    }
                    if (!this.JudgeIsNum(strCount))
                    {
                        throw new Exception("请输入数字");
                    }
                    AssignDetail assign = new AssignDetail();
                    assign.cnnAssignSerialNo  = Convert.ToDecimal(dgi.Cells[0].Text);
                    assign.cnnProduceSerialNo = Convert.ToDecimal(txtProduceSerialNo.Text);
                    assign.cnnOrderSerialNo   = Convert.ToDecimal(dgi.Cells[3].Text);
                    assign.cnvcProductCode    = dgi.Cells[6].Text;
                    assign.cnnCount           = Convert.ToDecimal(((TextBox)dgi.Cells[11].Controls[1]).Text);
                    string  strOrderType = dgi.Cells[13].Text;
                    decimal dOrderCount  = Convert.ToDecimal(dgi.Cells[10].Text);
                    if (strOrderType == "WDO")
                    {
                        if (dOrderCount > assign.cnnCount)
                        {
                            throw new Exception("外订定单分货量不能少于订单量");
                        }
                    }
                    alDetail.Add(assign);
                }

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整分货量";

                GoodsFacade gf = new GoodsFacade();
                gf.BatchUpdateAssignLog(alDetail, operLog, txtProduceSerialNo.Text);

                this.Popup("修改成功");
                //this.DataGrid2.EditItemIndex = -1;
                BindAssignDetail();

                this.btnEdit.Visible        = true;
                this.btnEndEdit.Visible     = false;
                this.btnEditConfirm.Visible = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 20
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            //更新
            try
            {
                //if(!JudgeIsCode())
                Material mat = new Material();
                mat.cnvcMaterialCode = ((TextBox)e.Item.Cells[0].Controls[1]).Text;


                mat.cnvcMaterialName = ((TextBox)e.Item.Cells[1].Controls[0]).Text;
                mat.cnvcLeastUnit    = ((DropDownList)e.Item.Cells[2].Controls[1]).SelectedValue;
                mat.cnnPrice         = decimal.Parse(((TextBox)e.Item.Cells[3].Controls[0]).Text);
                mat.cnvcProductType  = ((DropDownList)e.Item.Cells[4].Controls[1]).SelectedValue;
                mat.cnnConversion    = decimal.Parse(((TextBox)e.Item.Cells[6].Controls[0]).Text);
                mat.cnvcUnit         = ((TextBox)e.Item.Cells[7].Controls[0]).Text;
                mat.cnvcStandardUnit = ((TextBox)e.Item.Cells[8].Controls[0]).Text;
                mat.cnnStatdardCount = decimal.Parse(((TextBox)e.Item.Cells[9].Controls[0]).Text);

                mat.cnvcProductClass = ((DropDownList)e.Item.Cells[5].Controls[1]).SelectedValue;

                if (!JudgeIsCode(mat.cnvcProductType, mat.cnvcProductClass, mat.cnvcMaterialCode))
                {
                    //Popup("编码错误");
                    //return;
                    throw new Exception("编码错误");
                }

                string strOldMaterialCode = e.Item.Cells[11].Text;

                if (strOldMaterialCode != mat.cnvcMaterialCode)
                {
                    string    strSql     = "select * from tbMaterial where cnvcMaterialCode='" + mat.cnvcMaterialCode + "'";
                    DataTable dtMaterial = Helper.Query(strSql);
                    if (dtMaterial.Rows.Count > 0)
                    {
                        //throw new Exception("相同编码原料材料已存在");
                        Popup("相同编码原料材料已存在");
                        return;
                    }
                }

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "修改原料材料";

                MaterialFacade mf = new MaterialFacade();
                mf.UpdateMaterial(mat, strOldMaterialCode, operLog);
                this.DataGrid1.EditItemIndex = -1;
                BindMaterial();
                Popup("更新成功!");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
                return;
            }
        }
Exemplo n.º 21
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                string strCheckCount = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
                if (this.JudgeIsNull(strCheckCount))
                {
                    throw new Exception("请输入盘点量");
                }
                if (!this.JudgeIsNum(strCheckCount))
                {
                    throw new Exception("请输入数字");
                }
                string  strProduceCount = e.Item.Cells[5].Text;
                decimal dProduceCount   = Convert.ToDecimal(strProduceCount);
                decimal dCheckCount     = Convert.ToDecimal(strCheckCount);
                if (dCheckCount > dProduceCount)
                {
                    throw new Exception("盘点量过大,请手工调整");
                }
                if (Session["tbProduceDetail"] == null)
                {
                    ProduceCheckLog check = new ProduceCheckLog();
                    check.cnvcOperID         = oper.strLoginID;
                    check.cnnProduceSerialNo = Convert.ToDecimal(e.Item.Cells[0].Text);
                    check.cnvcInvCode        = e.Item.Cells[1].Text;
                    check.cnnCheckCount      = Convert.ToDecimal(strCheckCount);
                    GoodsFacade gf = new GoodsFacade();

                    OperLog operLog = new OperLog();
                    operLog.cnvcOperID   = oper.strLoginID;
                    operLog.cnvcDeptID   = oper.strDeptID;
                    operLog.cnvcOperType = "调整盘点量";

                    gf.UpdateProduceCheck(check, operLog);
                }
                else
                {
                    string    strCode   = e.Item.Cells[1].Text;
                    DataTable dtProduce = (DataTable)Session["tbProduceDetail"];
                    DataRow[] drProduct = dtProduce.Select("cnvcInvCode='" + strCode + "'");
                    drProduct[0]["cnnCheckCount"] = strCheckCount;
                    Session["tbProduceDetail"]    = dtProduce;
                }

                this.DataGrid1.EditItemIndex = -1;
                this.BindGrid();
                this.Popup("修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Exemplo n.º 22
0
        public void AddProductLostSerial(ArrayList alLostSerial, OperLog operLog)       //,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    SerialNo serialNo = new SerialNo();
                    serialNo.cnvcFill    = "0";
                    serialNo.cnnSerialNo = Convert.ToInt32(EntityMapping.Create(serialNo, trans));
                    for (int i = 0; i < alLostSerial.Count; i++)
                    {
                        LostSerial ls = (LostSerial)alLostSerial[i];
                        ls.cnvcLostType    = "0";
                        ls.cndOperDate     = dtSysTime;
                        ls.cnnLostSerialNo = serialNo.cnnSerialNo;
                        EntityMapping.Create(ls, trans);

//						ProductLostSerialLog productLostSerialLog = new ProductLostSerialLog(productLostSerial.ToTable());
//						//productSerialLog.cnnSerialNo = null;
//						productLostSerialLog.cnnProductLostSerialNo = serialNo.cnnSerialNo;
//						EntityMapping.Create(productLostSerialLog, trans);
                    }

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "生产产品报损,报损流水:" + serialNo.cnnSerialNo.ToString();

                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 23
0
        public void AdjustProductLostSerial_Add(LostSerial ls, OperLog operLog)       //,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    LostSerial oldls = EntityMapping.Get(ls, trans) as LostSerial;
                    if (oldls == null)
                    {
                        throw new Exception("未找到对应报损流水的产品!");
                    }

                    oldls.cnnAddCount    = ls.cnnAddCount;
                    oldls.cnnReduceCount = ls.cnnReduceCount;
                    oldls.cnvcOperID     = operLog.cnvcOperID;
                    oldls.cndOperDate    = dtSysTime;
                    EntityMapping.Update(oldls, trans);

//					ProductLostSerialLog productLostSerialLog = new ProductLostSerialLog(oldProductLostSerial.ToTable());
//					productLostSerialLog.cnnProductLostSerialNo = oldProductLostSerial.cnnSerialNo;
//					EntityMapping.Create(productLostSerialLog, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "生产产品报损调整,报损流水:" + oldls.cnnLostSerialNo.ToString() + ",产品编码:" + ls.cnvcInvCode;

                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 24
0
        public int UpdateWareHouse(OperLog operLog, Entity.Warehouse wh)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    Entity.Warehouse oldwh = new AMSApp.zhenghua.Entity.Warehouse();
                    oldwh.cnvcWhCode = wh.cnvcWhCode;

                    oldwh                  = EntityMapping.Get(oldwh, trans) as AMSApp.zhenghua.Entity.Warehouse;
                    oldwh.cnvcWhName       = wh.cnvcWhName;
                    oldwh.cnvcDepCode      = wh.cnvcDepCode;
                    oldwh.cnvcWhAddress    = wh.cnvcWhAddress;
                    oldwh.cnvcWhPhone      = wh.cnvcWhPhone;
                    oldwh.cnvcWhPerson     = wh.cnvcWhPerson;
                    oldwh.cnvcWhValueStyle = wh.cnvcWhValueStyle;
                    oldwh.cnbFreeze        = wh.cnbFreeze;
                    oldwh.cnnFrequency     = wh.cnnFrequency;
                    oldwh.cnvcFrequency    = wh.cnvcFrequency;
                    oldwh.cnvcWhProperty   = wh.cnvcWhProperty;
                    oldwh.cnbShop          = wh.cnbShop;
                    EntityMapping.Update(oldwh, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "仓库编码:" + oldwh.cnvcWhCode;
                    EntityMapping.Create(operLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    return(-1);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    return(-1);
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
                return(1);
            }
        }
Exemplo n.º 25
0
        public void AddOrder(OrderBook orderBook, DataTable dtOrderBookDetail, OperLog operLog)      //,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    OrderSerialNo serialNo = new OrderSerialNo();
                    serialNo.cnvcFill    = "0";
                    serialNo.cnnSerialNo = Convert.ToDecimal(EntityMapping.Create(serialNo, trans));

                    orderBook.cnnOrderSerialNo = serialNo.cnnSerialNo;
                    orderBook.cndOrderDate     = dtSysTime;
                    orderBook.cnvcOrderOperID  = operLog.cnvcOperID;
                    EntityMapping.Create(orderBook, trans);
                    foreach (DataRow drOrderBookDetail in dtOrderBookDetail.Rows)
                    {
                        OrderBookDetail detail = new OrderBookDetail(drOrderBookDetail);
                        detail.cnnOrderSerialNo = serialNo.cnnSerialNo;
                        detail.cndOperDate      = dtSysTime;
                        detail.cnvcOperID       = operLog.cnvcOperID;
                        EntityMapping.Create(detail, trans);
                    }
                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "订单流水:" + orderBook.cnnOrderSerialNo;
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 26
0
        public void AdjustCheckSerial_Delete(CheckSerial CheckSerial, OperLog operLog)       //,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    CheckSerial oldCheckSerial = EntityMapping.Get(CheckSerial, trans) as CheckSerial;
                    if (oldCheckSerial == null)
                    {
                        throw new Exception("未找到对应盘点流水的产品!");
                    }

                    oldCheckSerial.cnnReduceCount = CheckSerial.cnnReduceCount;
                    oldCheckSerial.cnvcOperID     = operLog.cnvcOperID;
                    oldCheckSerial.cndOperDate    = dtSysTime;
                    EntityMapping.Delete(oldCheckSerial, trans);

                    CheckSerialLog checkSerialLog = new CheckSerialLog(oldCheckSerial.ToTable());
                    checkSerialLog.cnnCheckSerialNo = oldCheckSerial.cnnSerialNo;
                    EntityMapping.Create(checkSerialLog, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "盘点删除,盘点流水:" + oldCheckSerial.cnnSerialNo.ToString() + ",产品编码:" + CheckSerial.cnvcCode;

                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 27
0
        //更新
        public void UpdateProduceCheck(ProduceCheckLog check, OperLog operLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    ProduceCheckLog oldCheck = new ProduceCheckLog();
                    oldCheck.cnnProduceSerialNo = check.cnnProduceSerialNo;
                    oldCheck.cnvcInvCode        = check.cnvcInvCode;
                    oldCheck = EntityMapping.Get(oldCheck, trans) as ProduceCheckLog;
                    if (oldCheck == null)
                    {
                        throw new Exception("未找到指定产品生产库存");
                    }
                    oldCheck.cnnCheckCount = check.cnnCheckCount;
                    oldCheck.cnnTeamID     = check.cnnTeamID;
                    oldCheck.cnnProducerID = check.cnnProducerID;
                    oldCheck.cnvcOperID    = check.cnvcOperID;
                    oldCheck.cndOperDate   = dtSysTime;
                    EntityMapping.Update(oldCheck, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "生产流水:" + check.cnnProduceSerialNo.ToString() + "[" + check.cnvcInvCode + ":" + check.cnnCheckCount.ToString() + "]";
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 28
0
        public int DeleteComputationUnit(OperLog operLog, Entity.ComputationUnit cu)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    Entity.ComputationUnit oldcu = new Entity.ComputationUnit();
                    oldcu.cnvcComunitCode = cu.cnvcComunitCode;

                    oldcu = EntityMapping.Get(oldcu, trans)  as Entity.ComputationUnit;
                    if (oldcu == null)
                    {
                        throw new Exception("未找到记录单位");
                    }
                    if (oldcu.cnbMainUnit)
                    {
                        throw new Exception("主计量单位不能删除");
                    }
                    EntityMapping.Delete(oldcu, trans);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "计量单位组编码:" + cu.cnvcComunitCode;
                    EntityMapping.Create(operLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    return(-1);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    return(-1);
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
                return(1);
            }
        }
Exemplo n.º 29
0
        internal static int InsertOperLog(OperLog oper)
        {
            using (var cn = new MySqlConnection(sqlconnectionString))
            {
                cn.Open();
                int i = cn.Execute(@"
insert into " + database1 + @".Q_OperLog(IP,CreateTime,UserAccount,UserName,LeftMenu,OperType,OperDetail) values(
 @IP, @CreateTime,@UserAccount,@UserName,@LeftMenu,@OperType,@OperDetail
);
", oper);
                cn.Close();
                return(i);
            }
        }
Exemplo n.º 30
0
        private void DataGrid2_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
//				if(txtProduceState.Text == "4")
//				{
//					throw new Exception("此订单已运输,不能修改分货量");
//				}
                string strCount = ((TextBox)e.Item.Cells[11].Controls[0]).Text;
                if (this.JudgeIsNull(strCount))
                {
                    throw new Exception("请输入盘点量");
                }
                if (!this.JudgeIsNum(strCount))
                {
                    throw new Exception("请输入数字");
                }
                AssignDetail assign = new AssignDetail();
                assign.cnnAssignSerialNo  = Convert.ToDecimal(e.Item.Cells[0].Text);
                assign.cnnProduceSerialNo = Convert.ToDecimal(txtProduceSerialNo.Text);
                assign.cnnOrderSerialNo   = Convert.ToDecimal(e.Item.Cells[3].Text);
                assign.cnvcProductCode    = e.Item.Cells[6].Text;
                assign.cnnCount           = Convert.ToDecimal(((TextBox)e.Item.Cells[11].Controls[0]).Text);
                string  strOrderType = e.Item.Cells[14].Text;
                decimal dOrderCount  = Convert.ToDecimal(e.Item.Cells[10].Text);
                if (strOrderType == "WDO")
                {
                    if (dOrderCount > assign.cnnCount)
                    {
                        throw new Exception("外订定单分货量不能少于订单量");
                    }
                }
                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整分货量";

                GoodsFacade gf = new GoodsFacade();
                gf.UpdateAssignLog(assign, operLog);
                this.Popup("修改成功");
                this.DataGrid2.EditItemIndex = -1;
                BindAssignDetail();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }