Esempio n. 1
0
        private void GetCon()
        {
            switch (OperationType)
            {
            case OperationType.出库:
                ConTable.Rows.Clear();
                ConList.Clear();
                foreach (var row in listViewCon.Rows)
                {
                    frmConChooseExLayout CRow = (frmConChooseExLayout)row.Control;
                    if (CRow.CheckBox1.Checked)
                    {
                        decimal Quant;
                        if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的库存格式不正确。");
                        }
                        decimal Quantity;
                        if (decimal.TryParse(CRow.numeric1.Value.ToString(), out Quantity) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的数量格式不正确。");
                        }
                        decimal Money;
                        if (decimal.TryParse(CRow.numeric2.Value.ToString(), out Money) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的金额格式不正确。");
                        }
                        if (Quantity > Quant)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "库存不足。");
                        }
                        AddCon(CRow.LblCId.Text, Quant, Quantity, Money, CRow.Image.ResourceID, CRow.lblName.Text);
                    }
                }
                break;

            case OperationType.入库:
                ConTable.Rows.Clear();
                ConList.Clear();
                foreach (var row in listViewCon.Rows)
                {
                    frmConChooseLayout CRows = (frmConChooseLayout)row.Control;
                    if (CRows.CheckBox1.Checked)
                    {
                        decimal Quantity;
                        if (decimal.TryParse(CRows.numeric1.Value.ToString(), out Quantity) == false)
                        {
                            throw new Exception("耗材编号" + CRows.LblCId.Text + "的数量格式不正确。");
                        }
                        decimal Money;
                        if (decimal.TryParse(CRows.numeric2.Value.ToString(), out Money) == false)
                        {
                            throw new Exception("耗材编号" + CRows.LblCId.Text + "的金额格式不正确。");
                        }
                        AddCon(CRows.LblCId.Text, 0, Quantity, Money, CRows.Image.ResourceID, CRows.lblName.Text);
                    }
                }
                break;
            }
        }
Esempio n. 2
0
        private void GetRows()
        {
//            OoList.Clear();
//            WrList.Clear();
            switch (OperationType)
            {
            case OperationType.出库:
                foreach (var row in listViewCon.Rows)
                {
                    frmConChooseExLayout CRow = (frmConChooseExLayout)row.Control;
                    if (ConList.Contains(CRow.LblCId.Text))
                    {
                        decimal Quant;
                        if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的库存格式不正确。");
                        }
                        decimal Quantity;
                        if (decimal.TryParse(CRow.numeric1.Value.ToString(), out Quantity) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的数量格式不正确。");
                        }
                        decimal Money;
                        if (decimal.TryParse(CRow.numeric2.Value.ToString(), out Money) == false)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "的金额格式不正确。");
                        }
                        if (Quantity > Quant)
                        {
                            throw new Exception("耗材编号" + CRow.LblCId.Text + "库存不足。");
                        }
                        AddCon(CRow.LblCId.Text, Quant, Quantity, Money, CRow.Image.ResourceID, CRow.lblName.Text);
                        if (OoList.Any(a => a.CID == CRow.LblCId.Text))
                        {
                            OutboundOrderRowInputDto dto = OoList.Find(a => a.CID == CRow.LblCId.Text);
                            dto.MONEY    = Money;
                            dto.QUANTITY = Quantity;
                        }
                        else
                        {
                            OutboundOrderRowInputDto rowInput = new OutboundOrderRowInputDto
                            {
                                CID      = CRow.LblCId.Text,
                                MONEY    = Money,
                                NOTE     = "",
                                QUANTITY = Quantity
                            };
                            OoList.Add(rowInput);
                        }
                    }
                }
                break;

            case OperationType.入库:
                foreach (var row in listViewCon.Rows)
                {
                    frmConChooseLayout CRows = (frmConChooseLayout)row.Control;
                    if (ConList.Contains(CRows.LblCId.Text))
                    {
                        decimal Quantity;
                        if (decimal.TryParse(CRows.numeric1.Value.ToString(), out Quantity) == false)
                        {
                            throw new Exception("耗材编号" + CRows.LblCId.Text + "的数量格式不正确。");
                        }
                        decimal Money;
                        if (decimal.TryParse(CRows.numeric2.Value.ToString(), out Money) == false)
                        {
                            throw new Exception("耗材编号" + CRows.LblCId.Text + "的金额格式不正确。");
                        }
                        AddCon(CRows.LblCId.Text, 0, Quantity, Money, CRows.Image.ResourceID, CRows.lblName.Text);
                        if (WrList.Any(a => a.CID == CRows.LblCId.Text))
                        {
                            WarehouseReceiptRowInputDto dto = WrList.Find(a => a.CID == CRows.LblCId.Text);
                            dto.MONEY    = Money;
                            dto.QUANTITY = Quantity;
                        }
                        else
                        {
                            WarehouseReceiptRowInputDto rowInput = new WarehouseReceiptRowInputDto
                            {
                                CID      = CRows.LblCId.Text,
                                MONEY    = Money,
                                NOTE     = "",
                                QUANTITY = Quantity
                            };
                            WrList.Add(rowInput);
                        }
                    }
                }
                break;
            }


//            foreach (var row in listViewCon.Rows)
//            {
//
//                OperCreateConExLayout CRow = (OperCreateConExLayout)row.Control;
//                decimal Quant;
//                if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false)
//                {
//                    throw new Exception("耗材编号" + CRow.lblCId.Text + "的库存格式不正确。");
//                }
//                decimal Quantity;
//                if (decimal.TryParse(CRow.numQuant.Value.ToString(), out Quantity) == false)
//                {
//                    throw new Exception("耗材编号" + CRow.lblCId.Text + "的数量格式不正确。");
//                }
//                decimal Money;
//                if (decimal.TryParse(CRow.numMoney.Value.ToString(), out Money) == false)
//                {
//                    throw new Exception("耗材编号" + CRow.lblCId.Text + "的金额格式不正确。");
//                }
//                if (Quantity > Quant)
//                {
//                    throw new Exception("耗材编号" + CRow.lblCId.Text + "库存不足。");
//                }
//                OutboundOrderRowInputDto rowInput = new OutboundOrderRowInputDto
//                {
//                    CID = CRow.lblCId.Text,
//                    MONEY = Money,
//                    NOTE = CRow.txtRNote.Text,
//                    QUANTITY = Quantity
//                };
//                rowsInputDtos.Add(rowInput);
//            }
        }
Esempio n. 3
0
        public string UserId;                                                                        //用户编号


        #endregion

        /// <summary>
        /// 当全选发生变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Checkall_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (Checkall.Checked)
                {
                    switch (OperationType)
                    {
                    case OperationType.出库:
                        foreach (var row in listViewCon.Rows)
                        {
                            frmConChooseExLayout CRow = (frmConChooseExLayout)row.Control;
                            CRow.CheckBox1.Checked = true;
                            decimal Quant;
                            if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false)
                            {
                                throw new Exception("耗材编号" + CRow.LblCId.Text + "的库存格式不正确。");
                            }
                            decimal Quantity;
                            if (decimal.TryParse(CRow.numeric1.Value.ToString(), out Quantity) == false)
                            {
                                throw new Exception("耗材编号" + CRow.LblCId.Text + "的数量格式不正确。");
                            }
                            decimal Money;
                            if (decimal.TryParse(CRow.numeric2.Value.ToString(), out Money) == false)
                            {
                                throw new Exception("耗材编号" + CRow.LblCId.Text + "的金额格式不正确。");
                            }
                            if (Quantity > Quant)
                            {
                                throw new Exception("耗材编号" + CRow.LblCId.Text + "库存不足。");
                            }
                            AddCon(CRow.LblCId.Text, Quant, Quantity, Money, CRow.Image.ResourceID, CRow.lblName.Text);
                        }
                        break;

                    case OperationType.入库:
                        foreach (var row in listViewCon.Rows)
                        {
                            frmConChooseLayout CRows = (frmConChooseLayout)row.Control;
                            CRows.CheckBox1.Checked = true;
                            decimal Quantity;
                            if (decimal.TryParse(CRows.numeric1.Value.ToString(), out Quantity) == false)
                            {
                                throw new Exception("耗材编号" + CRows.LblCId.Text + "的数量格式不正确。");
                            }
                            decimal Money;
                            if (decimal.TryParse(CRows.numeric2.Value.ToString(), out Money) == false)
                            {
                                throw new Exception("耗材编号" + CRows.LblCId.Text + "的金额格式不正确。");
                            }
                            AddCon(CRows.LblCId.Text, 0, Quantity, Money, CRows.Image.ResourceID, CRows.lblName.Text);
                        }
                        break;
                    }
                }
                else
                {
                    switch (OperationType)
                    {
                    case OperationType.出库:
                        foreach (var row in listViewCon.Rows)
                        {
                            frmConChooseExLayout CRow = (frmConChooseExLayout)row.Control;
                            CRow.CheckBox1.Checked = false;
                        }
                        break;

                    case OperationType.入库:
                        foreach (var row in listViewCon.Rows)
                        {
                            frmConChooseLayout CRows = (frmConChooseLayout)row.Control;
                            CRows.CheckBox1.Checked = false;
                        }
                        break;
                    }
                    ConTable.Rows.Clear();
                    ConList.Clear();

                    ;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }