Ejemplo n.º 1
0
 private void ShowInfo(int SID)
 {
     Cao.WMS.BLL.caowms.Store   bll   = new Cao.WMS.BLL.caowms.Store();
     Cao.WMS.Model.caowms.Store model = bll.GetModel(SID);
     this.lblSID.Text       = model.SID.ToString();
     this.lblSGID.Text      = model.SGID;
     this.lblSWID.Text      = model.SWID.ToString();
     this.lblSTopLine.Text  = model.STopLine.ToString();
     this.lblSbaseLine.Text = model.SbaseLine.ToString();
     this.lblSQuantity.Text = model.SQuantity.ToString();
 }
Ejemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtRGID.Text.Trim().Length == 0)
            {
                strErr += "SKU编号不能为空!\\n";
            }
            if (this.txtRWID.Text.Trim().Length == 0)
            {
                strErr += "存储仓库编号不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtRQuantity.Text))
            {
                strErr += "进出数量格式错误!\\n";
            }
            //if(!PageValidate.IsNumber(txtRtype.Text))
            //{
            //    strErr+="1入库  2出库格式错误!\\n";
            //}
            if (this.txtRHandler.Text.Trim().Length == 0)
            {
                strErr += "提(送)货人名不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtRTime.Text))
            {
                strErr += "RTime格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    RID       = int.Parse(this.lblRID.Text);
            string RGID      = this.txtRGID.Text;
            string RWID      = this.txtRWID.Text;
            int    RQuantity = int.Parse(this.txtRQuantity.Text);

            int      Rtype    = 1;
            string   RHandler = this.txtRHandler.Text;
            DateTime RTime    = DateTime.Parse(this.txtRTime.Text);

            if (RadioButton2.Checked == true)
            {
                Rtype = 2;
            }
            else
            {
                Rtype = 1;
            }

            //判断如果SKU和仓库
            addGoods();
            addWarehouses();
            //如果没有此款规则 则添加默认规则
            ExistsGoodsGIDadnWarehousesWID();

            if (!addStore)
            {
                newSQuantity = "0"; //当前数量为0;
            }
            else
            {
                modelStore   = bllStore.GetModel(this.txtRGID.Text, this.txtRWID.Text);
                newSQuantity = modelStore.SQuantity.ToString();
            }

            //否则 根据出入库计算 当前数据
            //当前数量 入库则加
            if (Rtype == 1)
            {
                //当前数据库加 现在入库的
                // newSQuantity = Convert.ToString(int.Parse(newSQuantity) + int.Parse(txtSQuantity.Text));
                newSQuantity         = Convert.ToString(int.Parse(newSQuantity) + RQuantity);
                modelStore.SQuantity = int.Parse(newSQuantity);
                bllStore.Update(modelStore);
            }
            //出库则减
            else
            {
                //当前数据库减 现在入库的
                //newSQuantity = Convert.ToString(int.Parse(newSQuantity) - int.Parse(txtSQuantity.Text));
                newSQuantity = Convert.ToString(int.Parse(newSQuantity) + RQuantity);
                if (int.Parse(newSQuantity) < 0)
                {
                    strErr += "超出库存量 \\n";
                    MessageBox.Show(this, strErr);
                    return;
                }
                if (int.Parse(newSQuantity) == 0)
                {
                    strErr += "SKU清空为0 \\n";
                    MessageBox.Show(this, strErr);
                    // return;
                }
                modelStore.SQuantity = int.Parse(newSQuantity);
                bllStore.Update(modelStore);
            }


            Cao.WMS.Model.caowms.Records model = new Cao.WMS.Model.caowms.Records();
            model.RID       = RID;
            model.RGID      = RGID;
            model.RWID      = RWID;
            model.RQuantity = RQuantity;
            model.Rtype     = Rtype;
            model.RHandler  = RHandler;
            model.RTime     = RTime;
            model.n_bakk    = this.txt_bak.Text.Trim();

            Cao.WMS.BLL.caowms.Records bll = new Cao.WMS.BLL.caowms.Records();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }