Example #1
0
        protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DropDownList dropZL     = (DropDownList)e.Item.FindControl("dropZL");
            Literal      ltlC_VDEF1 = (Literal)e.Item.FindControl("ltlC_VDEF1");
            LinkButton   lbtDel     = (LinkButton)e.Item.FindControl("lbtDel");

            Literal ltlyorderno = (Literal)e.Item.FindControl("ltlyorderno");
            Literal ltlywgt     = (Literal)e.Item.FindControl("ltlywgt");
            Literal ltlylxnum   = (Literal)e.Item.FindControl("ltlylxnum");
            Literal ltldlxnum   = (Literal)e.Item.FindControl("ltldlxnum");
            Literal ltlmatcode  = (Literal)e.Item.FindControl("ltlmatcode");
            Literal ltlN_TYPE   = (Literal)e.Item.FindControl("ltlN_TYPE");
            TextBox txtWgt      = (TextBox)e.Item.FindControl("txtWgt");

            #region //判断当前状态
            bool res = ltlN_CON_STATUS.Text == "-1" ? !tmo_order.Exists_OrderPlan(ltlyorderno.Text) : false;
            lbtDel.Visible = res;
            txtWgt.Enabled = res;
            #endregion

            #region //质量等级
            DataTable dtzl = tqb_checkstate.GetCheckState("").Tables[0];
            if (dtzl.Rows.Count > 0)
            {
                dropZL.DataSource     = dtzl;
                dropZL.DataTextField  = "C_CHECKSTATE_NAME";
                dropZL.DataValueField = "C_ID";
                dropZL.DataBind();
                dropZL.SelectedIndex = dropZL.Items.IndexOf(dropZL.Items.FindByValue(ltlC_VDEF1.Text));
            }
            #endregion

            #region //原合同已履行量/待履行量

            decimal exenum = 0;
            decimal wgt    = 0;

            if (!string.IsNullOrEmpty(ltlyorderno.Text))
            {
                DataRow dr = tmo_order.GetOrderExeNum(ltlmatcode.Text, ltlyorderno.Text, Convert.ToInt32(ltlN_TYPE.Text));
                if (dr != null)
                {
                    exenum = Convert.ToDecimal(dr["YLXNUM"].ToString());//原合同履行量
                }


                ltlywgt.Text = tmo_order.GetOrderWgt(ltlyorderno.Text);//原合同数量
                wgt          = Convert.ToDecimal(ltlywgt.Text);
            }



            ltlylxnum.Text = exenum.ToString();              //已履行量
            ltldlxnum.Text = Convert.ToString(wgt - exenum); //待履行量

            #endregion
        }
Example #2
0
        //批量排产
        protected void btnPLPC_Click(object sender, EventArgs e)
        {
            try
            {
                bool result  = true; //判定是否超出原合同订单量
                bool result2 = true; //判定排产量是否有效数字

                bool result3 = true; //判定是否满足排产指标

                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();
                List <string[]>      list_log  = new List <string[]>();

                for (int i = 0; i < rptList.Items.Count; i++)
                {
                    HtmlInputCheckBox cbx_order = (HtmlInputCheckBox)rptList.Items[i].FindControl("cbx_order");
                    Literal           ltlwgt    = (Literal)rptList.Items[i].FindControl("ltlwgt");
                    Literal           ltldlxwgt = (Literal)rptList.Items[i].FindControl("ltldlxwgt");
                    Literal           ltlpcwgt  = (Literal)rptList.Items[i].FindControl("ltlpcwgt");
                    if (cbx_order.Checked)
                    {
                        if (Convert.ToDecimal(ltldlxwgt.Text) > 0)
                        {
                            //decimal sum = Convert.ToDecimal(ltlpcwgt.Text) + Convert.ToDecimal(ltldlxwgt.Text);
                            decimal sum = Convert.ToDecimal(ltlpcwgt.Text);
                            decimal wgt = Convert.ToDecimal(ltlwgt.Text);

                            //判定是否排产量大于订单量
                            if (sum > Convert.ToDecimal(ltlwgt.Text))
                            {
                                result = false;
                                break;
                            }
                            else
                            {
                                decimal n = wgt - sum; //订单量减去已排产量

                                if (n > 0)             //判定剩余排产是否大于0
                                {
                                    Mod_TMO_ORDER modOrder = tmo_order.GetModel(cbx_order.Value);

                                    //校验是否满足排产指标
                                    if (tmo_order_pczb.CheckStl_Grd_ZB(n, modOrder.C_AREA, modOrder.C_ORDER_NO, dropZB.SelectedItem.Value))
                                    {
                                        #region //生产订单号
                                        int    no = tmo_order.GetOrderPlanNum(modOrder.C_ORDER_NO, modOrder.C_CON_NO);
                                        string pc = modOrder.C_ORDER_NO + "/" + no.ToString();

                                        if (tmo_order.Exists_OrderPlan(pc, modOrder.C_CON_NO))
                                        {
                                            no += 1;
                                            pc  = modOrder.C_ORDER_NO + "/" + no.ToString();
                                        }
                                        #endregion

                                        modOrder.C_ORDER_NO    = pc;
                                        modOrder.N_EXEC_STATUS = -1;              //执行状态:提报订单
                                        modOrder.C_PCTBEMP     = ltlempName.Text; //提报人
                                        modOrder.N_WGT         = wgt - sum;       //需求排产量  Convert.ToDecimal(ltldlxwgt.Text);//待履行量
                                        orderList.Add(modOrder);
                                        string[] arr_log = { "提报订单", "合同履行表页面", GetClientIP(), ltlempid.Text, modOrder.C_ORDER_NO, modOrder.C_ID };
                                        list_log.Add(arr_log);
                                    }
                                    else
                                    {
                                        result3 = false;
                                        break;
                                    }
                                }
                                else
                                {
                                    result2 = false;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (result)      //判断排产量是否超出原订单量
                {
                    if (result2) //排产量是否有效数字
                    {
                        if (result3)
                        {
                            if (tmo_con.InsertNeedOrder(orderList))
                            {
                                //日志
                                tmo_order.InsertOrderPlanLog(list_log);

                                WebMsg.MessageBox("下发成功");
                                GetList();
                            }
                        }
                        else
                        {
                            WebMsg.MessageBox("其中批量排产订单量,不符合当月当旬排产指标");
                        }
                    }
                    else
                    {
                        WebMsg.MessageBox("其中批量排产订单有0排产量,请重新检查再次提交");
                    }
                }
                else
                {
                    WebMsg.MessageBox("当前需求排产量已超原合同订单量,请单独下发排产!");
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }
Example #3
0
        //合同订单排产
        protected void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                decimal sumwgt = Convert.ToDecimal(txtneedwgt.Text) + Convert.ToDecimal(ltlplanwgt.Text);

                //if (sumwgt > Convert.ToDecimal(ltlwgt.Text) || Convert.ToDecimal(txtneedwgt.Text) > Convert.ToDecimal(ltldlxwgt.Text))
                //{
                //    WebMsg.MessageBox("需求排产量已超原合同订单量或已超待履行量");
                //}

                if (sumwgt > Convert.ToDecimal(ltlwgt.Text))
                {
                    WebMsg.MessageBox("需求排产量已超原合同订单量或已超待履行量");
                }
                else
                {
                    List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();
                    List <string[]>      list_log  = new List <string[]>();

                    decimal wgt = 0;
                    decimal.TryParse(txtneedwgt.Text, out wgt);

                    if (wgt > 0)
                    {
                        if (!string.IsNullOrEmpty(txtPack.Text) && tqb_pack.Exists(txtPack.Text))
                        {
                            #region Insert

                            Mod_TMO_ORDER modOrder = tmo_order.GetModel(ltlOrderNo.Text);


                            //校验是否满足排产指标
                            if (tmo_order_pczb.CheckStl_Grd_ZB(wgt, modOrder.C_AREA, modOrder.C_ORDER_NO, dropZB.SelectedItem.Value))
                            {
                                #region //生产订单号
                                int    no = tmo_order.GetOrderPlanNum(modOrder.C_ORDER_NO, modOrder.C_CON_NO);
                                string pc = modOrder.C_ORDER_NO + "/" + no.ToString();

                                if (tmo_order.Exists_OrderPlan(pc, modOrder.C_CON_NO))
                                {
                                    no += 1;
                                    pc  = modOrder.C_ORDER_NO + "/" + no.ToString();
                                }
                                #endregion

                                modOrder.C_ORDER_NO    = pc;
                                modOrder.N_WGT         = wgt;             //需求排产量
                                modOrder.N_EXEC_STATUS = -1;              //执行状态:提报订单
                                modOrder.C_REMARK4     = txtremark.Text;  //特殊信息
                                modOrder.C_PCTBEMP     = ltlempname.Text; //提报人
                                modOrder.C_PACK        = txtPack.Text;    //包装要求

                                orderList.Add(modOrder);

                                string[] arr_log = { "提报订单", "合同履行表页面", GetClientIP(), ltlempid.Text, ltlOrderNo.Text, modOrder.C_ID };
                                list_log.Add(arr_log);
                                if (tmo_con.InsertNeedOrder(orderList))
                                {
                                    //日志
                                    tmo_order.InsertOrderPlanLog(list_log);
                                    Response.Write("<script>alert('提交成功');window.parent.document.getElementById('btncx').click();window.parent.close();</script>");
                                }
                            }
                            else
                            {
                                WebMsg.MessageBox("当前排产量,不符合当月当旬排产指标!");
                            }

                            #endregion
                        }
                        else
                        {
                            WebMsg.MessageBox("包装不能为空或与实际包装不符");
                        }
                    }
                    else
                    {
                        WebMsg.MessageBox("请输入有效需求排产量!");
                    }
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }