Exemplo n.º 1
0
        private bool 产品入库(string 产品编号, int 产品数量, int 合格产品数)
        {
            try{
                ProductFlow proflow = new ProductFlow();
                proflow.ProductId        = 产品编号;
                proflow.OccurredTime     = DateTime.Now;
                proflow.Type             = "生产入库";
                proflow.RelatedOrderId   = text相关订单编号.Text;
                proflow.RelatedPlanId    = text编号.Text;
                proflow.UnqualifiedCount = 合格产品数;
                proflow.Status           = ProductionStatus.IN;
                if (product.AddProduct(proflow, 产品数量))
                {
                    string state = ProductionPlanStatus.STORED;
                    if (!checkBox内部计划.Checked)
                    {
                        state = ProductionPlanStatus.TO_BE_SHIP;
                        // 扣除库存
                        product.UpdateProductStoreCount(-产品数量, 产品编号);
                    }

                    ppm.UpdatePlanStatus(state, text编号.Text);
                    MessageBox.Show("产品生产成功!!!");
                    return(true);
                }
                else
                {
                    MessageBox.Show("产品生产失败!!!");
                }
                return(false);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); return(false); }
        }