예제 #1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (strEditMode == "add")
     {
         CmcsGoodsType mine = new CmcsGoodsType()
         {
             TreeCode    = carTransportDao.GetGoodsTypeNewChildCode(Output.TreeCode),
             GoodsName   = txt_GoodsName.Text,
             IsValid     = chb_IsUse.Checked ? 1 : 0,
             OrderNumber = dbi_OrderNumber.Value,
             Remark      = txt_Remark.Text,
             ParentId    = Output.Id
         };
         carTransportDao.InsertGoodsType(mine);
     }
     else
     {
         Output.GoodsName   = txt_GoodsName.Text;
         Output.OrderNumber = dbi_OrderNumber.Value;
         Output.IsValid     = chb_IsUse.Checked ? 1 : 0;
         Output.Remark      = txt_Remark.Text;
         Output.IsSynch     = "0";
         carTransportDao.InsertGoodsType(Output);
     }
     FrmGoodsType_List_Shown(null, null);
 }
예제 #2
0
        private void InitTree()
        {
            IList <CmcsGoodsType> rootList = Dbers.GetInstance().SelfDber.Entities <CmcsGoodsType>();

            if (rootList.Count == 0)
            {
                //初始化根节点
                CmcsGoodsType rootGoods = new CmcsGoodsType();
                rootGoods.Id          = "-1";
                rootGoods.GoodsName   = "物资名称";
                rootGoods.TreeCode    = "00";
                rootGoods.IsValid     = 1;
                rootGoods.OrderNumber = 0;
                Dbers.GetInstance().SelfDber.Insert <CmcsGoodsType>(rootGoods);
            }

            advTree1.Nodes.Clear();

            CmcsGoodsType rootEntity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsType>("-1");

            DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity);

            LoadData(rootEntity, rootNode);

            advTree1.Nodes.Add(rootNode);

            this.Output = rootEntity;

            ProcessFromRequest(eEditMode.查看);
        }
예제 #3
0
        /// <summary>
        /// 根据父编码获取下级节点编码(父编码+2位逐级递增的数值)
        /// </summary>
        /// <param name="strCode"></param>
        /// <returns></returns>
        public string GetGoodsTypeNewChildCode(string strCode)
        {
            string        strNewCode = strCode;
            CmcsGoodsType mine       = new CmcsGoodsType();

            if (strCode == "00")
            {
                mine = commonDAO.SelfDber.Entity <CmcsGoodsType>("where ParentId=:ParentId order by TreeCode desc ", new { ParentId = "-1" });
            }
            else
            {
                mine = commonDAO.SelfDber.Entity <CmcsGoodsType>("where TreeCode like :TreeCode ||'%' and TreeCode !=:TreeCode order by TreeCode desc ", new { TreeCode = strCode });
            }
            if (mine != null)
            {
                strNewCode = mine.TreeCode.Replace(strCode, "");
                strNewCode = strCode + (Convert.ToInt32(strNewCode) + 1).ToString().PadLeft(2, '0');
            }
            else
            {
                if (strCode == "00")
                {
                    strNewCode = "0001";
                }
                else
                {
                    strNewCode = strCode + "01";
                }
            }

            return(strNewCode);
        }
예제 #4
0
 DevComponents.AdvTree.Node CreateNode(CmcsGoodsType entity)
 {
     DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(entity.GoodsName);
     node.Tag      = entity;
     node.Expanded = true;
     return(node);
 }
예제 #5
0
 void addCmcsGoodsType(CmcsGoodsType item)
 {
     txt_GoodsName.Text   = item.GoodsName;
     txt_Remark.Text      = item.Remark;
     dbi_OrderNumber.Text = item.OrderNumber.ToString();
     chb_IsUse.Checked    = (item.IsValid == 1);
 }
예제 #6
0
 void Return()
 {
     //if (advTree1.SelectedNode.Parent == null) return;
     this.Output = (advTree1.SelectedNode.Tag as CmcsGoodsType);
     addCmcsGoodsType(Output);
     strEditMode = "edit";
     EnableLeft();
 }
예제 #7
0
 private void FrmGoodsType_Select_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Output       = null;
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
        private void btnSelectGoodsType_Goods_Click(object sender, EventArgs e)
        {
            FrmGoodsType_Select frm = new FrmGoodsType_Select();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                this.SelectedGoodsType_Goods = frm.Output;
            }
        }
예제 #9
0
 void Return()
 {
     if (advTree1.SelectedNode.Parent == null)
     {
         return;
     }
     this.Output = (advTree1.SelectedNode.Tag as CmcsGoodsType);
     addCmcsGoodsType(Output);
 }
예제 #10
0
        /// <summary>
        /// 判断煤种名称是否存在
        /// </summary>
        /// <param name="fuelName">煤种名称</param>
        /// <returns></returns>
        public bool IsExistGoodsName(string goodsName, string id)
        {
            CmcsGoodsType entity = Dbers.GetInstance().SelfDber.Entity <CmcsGoodsType>("where GoodsName=:GoodsName and Id<>:Id", new { GoodsName = goodsName, Id = id });

            if (entity != null)
            {
                return(true);
            }
            return(false);
        }
예제 #11
0
        /// <summary>
        /// 判断煤种编码是否存在
        /// </summary>
        /// <param name="fuelCode">煤种编码</param>
        /// <returns></returns>
        public bool IsExistGoodsCode(string treeCode)
        {
            CmcsGoodsType entity = Dbers.GetInstance().SelfDber.Entity <CmcsGoodsType>("where TreeCode=:TreeCode", new { TreeCode = treeCode });

            if (entity != null)
            {
                return(true);
            }
            return(false);
        }
예제 #12
0
        /// <summary>
        /// 获取排序号
        /// </summary>
        /// <param name="parentMine"></param>
        /// <returns></returns>
        public int GetGoodsTypeOrderNumBer(CmcsGoodsType parentMine)
        {
            CmcsGoodsType goodstype = commonDAO.SelfDber.Entity <CmcsGoodsType>(" where ParentId=:ParentId order by OrderNumber desc", new { ParentId = parentMine.Id });

            if (goodstype != null)
            {
                goodstype.OrderNumber++;
                return(goodstype.OrderNumber);
            }
            return(0);
        }
예제 #13
0
        void Return()
        {
            if (advTree1.SelectedNode.Parent == null)
            {
                return;
            }

            this.Output       = (advTree1.SelectedNode.Tag as CmcsGoodsType);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #14
0
        private void FrmGoodsType_Select_Shown(object sender, EventArgs e)
        {
            advTree1.Nodes.Clear();

            CmcsGoodsType rootEntity = Dbers.GetInstance().SelfDber.Entity <CmcsGoodsType>("where ParentId is null");

            DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity);

            LoadData(rootEntity, rootNode);

            advTree1.Nodes.Add(rootNode);
        }
예제 #15
0
        /// <summary>
        /// 更新物资
        /// </summary>
        /// <param name="video"></param>
        /// <returns></returns>
        public bool InsertGoodsType(CmcsGoodsType video)
        {
            CmcsGoodsType entity = commonDAO.SelfDber.Entity <CmcsGoodsType>("where Id=:Id", new { Id = video.Id });

            if (entity == null)
            {
                return(commonDAO.SelfDber.Insert(video) > 0);
            }
            else
            {
                return(commonDAO.SelfDber.Update(video) > 0);
            }
        }
예제 #16
0
        void LoadData(CmcsGoodsType entity, DevComponents.AdvTree.Node node)
        {
            if (entity == null || node == null)
            {
                return;
            }

            foreach (CmcsGoodsType item in Dbers.GetInstance().SelfDber.Entities <CmcsGoodsType>("where ParentId=:ParentId order by OrderNumber asc", new { ParentId = entity.Id }))
            {
                DevComponents.AdvTree.Node newNode = CreateNode(item);
                node.Nodes.Add(newNode);
                LoadData(item, newNode);
            }
        }
예제 #17
0
        private void FrmGoodsType_List_Shown(object sender, EventArgs e)
        {
            advTree1.Nodes.Clear();

            CmcsGoodsType rootEntity = Dbers.GetInstance().SelfDber.Entity <CmcsGoodsType>("where ParentId is null");

            DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity);

            LoadData(rootEntity, rootNode);

            advTree1.Nodes.Add(rootNode);
            addCmcsGoodsType(rootEntity);
            CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(this);
        }
예제 #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidatePage())
            {
                return;
            }

            if (CurrEditMode == eEditMode.新增)
            {
                if (this.Output == null)
                {
                    return;
                }
                CmcsGoodsType entity = new CmcsGoodsType();
                entity.TreeCode    = commonDAO.GetGoodsNewChildCode(this.Output.TreeCode);
                entity.GoodsName   = txt_GoodsName.Text;
                entity.OrderNumber = dbi_OrderNumber.Value;
                entity.ParentId    = this.Output.Id;
                entity.IsValid     = chb_IsUse.Checked ? 1 : 0;
                entity.Remark      = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Insert <CmcsGoodsType>(entity);
            }
            else if (CurrEditMode == eEditMode.修改)
            {
                if (this.Output == null)
                {
                    return;
                }

                //是否更新子节点状态
                if (this.Output.IsValid != (chb_IsUse.Checked ? 1 : 0))
                {
                    if (MessageBoxEx.Show("是否将启用状态应用到子节点", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        commonDAO.UpdateGoodsChildsIsUse(this.Output.Id, chb_IsUse.Checked ? 1 : 0);
                    }
                }

                this.Output.GoodsName   = txt_GoodsName.Text;
                this.Output.OrderNumber = dbi_OrderNumber.Value;
                this.Output.IsValid     = chb_IsUse.Checked ? 1 : 0;
                this.Output.Remark      = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Update <CmcsGoodsType>(this.Output);
            }

            InitTree();
        }
예제 #19
0
        /// <summary>
        /// 删除物资
        /// </summary>
        /// <param name="video"></param>
        /// <returns></returns>
        public bool DelGoodsType(CmcsGoodsType video)
        {
            int res = 0;

            foreach (var item in commonDAO.SelfDber.Entities <CmcsGoodsType>("where ParentId=:ParentId", new { ParentId = video.Id }))
            {
                DelGoodsType(item);
            }
            try
            {
                if (commonDAO.SelfDber.Delete <CmcsGoodsType>(video.Id) > 0)
                {
                    res++;
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(res > 0);
        }
예제 #20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidatePage())
            {
                return;
            }

            if (CurrEditMode == eEditMode.新增)
            {
                if (this.Output == null)
                {
                    return;
                }
                CmcsGoodsType entity = new CmcsGoodsType();
                entity.TreeCode    = commonDAO.GetGoodsNewChildCode(this.Output.TreeCode);
                entity.GoodsName   = txt_GoodsName.Text;
                entity.OrderNumber = Convert.ToInt32(dbi_OrderNumber.Text);
                entity.ParentId    = this.Output.Id;
                entity.IsValid     = chb_IsUse.Checked ? 1 : 0;
                entity.Remark      = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Insert <CmcsGoodsType>(entity);
            }
            else if (CurrEditMode == eEditMode.修改)
            {
                if (this.Output == null)
                {
                    return;
                }
                this.Output.GoodsName   = txt_GoodsName.Text;
                this.Output.OrderNumber = Convert.ToInt32(dbi_OrderNumber.Text);
                this.Output.IsValid     = chb_IsUse.Checked ? 1 : 0;
                this.Output.Remark      = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Update <CmcsGoodsType>(this.Output);
            }

            InitTree();
        }
예제 #21
0
        private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
        {
            foreach (GridRow gridRow in e.GridPanel.Rows)
            {
                CmcsGoodsTransport entity = gridRow.DataItem as CmcsGoodsTransport;
                if (entity == null)
                {
                    return;
                }

                // 填充有效状态
                gridRow.Cells["clmIsUse"].Value = (entity.IsUse == 1 ? "是" : "否");
                CmcsSupplyReceive supplyunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.SupplyUnitId);
                if (supplyunit != null)
                {
                    gridRow.Cells["SupplyUnitName"].Value = supplyunit.UnitName;
                }
                CmcsSupplyReceive receiveunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.ReceiveUnitId);
                if (receiveunit != null)
                {
                    gridRow.Cells["ReceiveUnitName"].Value = receiveunit.UnitName;
                }
                CmcsGoodsType goodstype = Dbers.GetInstance().SelfDber.Get <CmcsGoodsType>(entity.GoodsTypeId);
                if (goodstype != null)
                {
                    gridRow.Cells["GoodsTypeName"].Value = goodstype.GoodsName;
                }
                if (entity.FirstWeight > 0 && entity.SecondWeight > 0)
                {
                    gridRow.CellStyles.Default.TextColor = Color.Green;
                }
                else if (entity.FirstWeight == 0 && entity.SecondWeight == 0)
                {
                    gridRow.CellStyles.Default.TextColor = Color.Red;
                }
            }
        }
예제 #22
0
 private void cmb_GoodsTypeName_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.cmcsGoodsType = cmb_GoodsTypeName.SelectedItem as CmcsGoodsType;
 }
예제 #23
0
        /// <summary>
        /// 生成其他物资运输排队记录
        /// </summary>
        /// <param name="autotruck">车辆</param>
        /// <param name="supply">供货单位</param>
        /// <param name="receive">收货单位</param>
        /// <param name="goodsType">物资类型</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <returns></returns>
        public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplier supply, CmcsSupplier receive, CmcsGoodsType goodsType, DateTime inFactoryTime, string remark, string place)
        {
            CmcsGoodsTransport transport = new CmcsGoodsTransport
            {
                SerialNumber    = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime),
                AutotruckId     = autotruck.Id,
                CarNumber       = autotruck.CarNumber,
                SupplyUnitId    = supply.Id,
                SupplyUnitName  = supply.Name,
                ReceiveUnitId   = receive.Id,
                ReceiveUnitName = receive.Name,
                GoodsTypeId     = goodsType.Id,
                GoodsTypeName   = goodsType.GoodsName,
                InFactoryTime   = inFactoryTime,
                IsFinish        = 0,
                IsUse           = 1,
                StepName        = eTruckInFactoryStep.入厂.ToString(),
                Remark          = remark
            };

            if (SelfDber.Insert(transport) > 0)
            {
                // 插入未完成运输记录
                return(SelfDber.Insert(new CmcsUnFinishTransport
                {
                    TransportId = transport.Id,
                    CarType = eCarType.其他物资.ToString(),
                    AutotruckId = autotruck.Id,
                    PrevPlace = place,
                }) > 0);
            }

            return(false);
        }
예제 #24
0
 void SelGoodsTypeNode()
 {
     this.Output = (advTree1.SelectedNode.Tag as CmcsGoodsType);
     ProcessFromRequest(eEditMode.查看);
 }
예제 #25
0
 private void btnDelGoodsType_Goods_Click(object sender, EventArgs e)
 {
     this.SelectedGoodsType_Goods = null;
 }
예제 #26
0
        /// <summary>
        /// 生成其他物资运输排队记录
        /// </summary>
        /// <param name="autotruck">车辆</param>
        /// <param name="supply">供货单位</param>
        /// <param name="receive">收货单位</param>
        /// <param name="goodsType">物资类型</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <returns></returns>
        public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplyReceive supply, CmcsGoodsType goodsType, string mineName, string upload, string fuelKindName, DateTime inFactoryTime, string remark, string place, ref CmcsGoodsTransport transport)
        {
            transport = new CmcsGoodsTransport
            {
                SerialNumber   = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime),
                AutotruckId    = autotruck.Id,
                CarNumber      = autotruck.CarNumber,
                SupplyUnitId   = supply != null ? supply.Id : "",
                SupplyUnitName = supply != null ? supply.UnitName : "",
                GoodsTypeId    = goodsType != null ? goodsType.Id : "",
                GoodsTypeName  = goodsType != null ? goodsType.GoodsName : "",
                FromMC         = mineName,
                ToMC           = upload,
                FuelKindName   = fuelKindName,
                InFactoryTime  = inFactoryTime,
                IsFinish       = 0,
                IsUse          = 1,
                StepName       = eTruckInFactoryStep.入厂.ToString(),
                Remark         = remark,
                CarType        = autotruck.CarType
            };

            return(SelfDber.Insert(transport) > 0);
        }