//自动动填写灰色区域的信息
 protected void AutoSetMessage(DataSet dataset, DataSet modelPO_line_List)
 {
     //使用try,catch捕捉int字段值为空的情况
     try
     {
         request_qty.Value = modelPO_line_List.Tables[0].Rows[0].ItemArray[4].ToString();
     }
     catch (Exception e) { request_qty.Value = ""; }
     try
     {
         po_line_id.Value   = modelPO_line_List.Tables[0].Rows[0].ItemArray[0].ToString();
         item_id_auto.Value = modelPO_line_List.Tables[0].Rows[0].ItemArray[3].ToString();
     }
     catch (Exception e) { po_line_id.Value = ""; item_id_auto.Value = ""; }
     try
     {
         po_header_id.Value = dataset.Tables[0].Rows[0].ItemArray[0].ToString();
     }
     catch (Exception e) { po_header_id.Value = ""; }
     try
     {
         vendor_code.Value = dataset.Tables[0].Rows[0].ItemArray[2].ToString();
         CustomersDC customersDC = new CustomersDC();
         DataSet     set         = customersDC.getCustomerByVendor_key(dataset.Tables[0].Rows[0].ItemArray[2].ToString());
         vendor_name.Value = set.Tables[0].Rows[0].ItemArray[0].ToString();
     }
     catch (Exception e) { po_header_id.Value = ""; }
     try
     {
         item_name_auto.Value = poDC.getItem_nameByItem_id(int.Parse(item_id_auto.Value));
     }
     catch (Exception e) { item_name_auto.Value = ""; }
 }
示例#2
0
        /// <summary>
        /// 编辑出货单单头信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Top_Edit(object sender, EventArgs e)
        {
            string strShip_key = edit_ship_key.Value;

            string strEdit_customer = edit_customer.Value;

            string strEdit_part_no = edit_part_no.Value;

            string strEdit_request_qty = Top_request_qty.Value;

            string strEdit_picked_qty = Top_picked_qty.Value;

            string ship_no = edit_ship_no.Value;

            int ship_key    = 0;
            int request_qty = 0;
            int picked_qty  = 0;
            int customer_id = 0;
            int part_no     = 0;

            try
            {
                ship_key = int.Parse(strShip_key);
                CustomersDC customerDc = new CustomersDC();
                customer_id = customerDc.getCustomeridByname(strEdit_customer);
                if (customer_id == -1)
                {
                    PageUtil.showToast(this, "该客户不存在,请检查数据!");
                    return;
                }
                request_qty = int.Parse(strEdit_request_qty);
                if (request_qty < 0)
                {
                    PageUtil.showToast(this, "数据格式错误,请输入数字!");
                    return;
                }
                picked_qty = int.Parse(strEdit_picked_qty);
                if (picked_qty < 0)
                {
                    PageUtil.showToast(this, "数据格式错误,请输入数字!");
                    return;
                }
                else if (picked_qty > 0)
                {
                    PageUtil.showToast(this, "该出货单已进行过出货操作,暂不支持修改!");
                    return;
                }
                PnDC pndc = new PnDC();
                part_no = pndc.getItem_idByItem_name(strEdit_part_no);
                if (part_no == -1)
                {
                    PageUtil.showToast(this, "该料号不存在!");
                    return;
                }
            }
            catch (Exception ex)
            {
                PageUtil.showToast(this, "数据异常!");
                return;
            }
            Transaction_operationDC trandc = new Transaction_operationDC();
            DataSet tds = trandc.getTransactionBySome("shipping", strEdit_part_no, ship_no);

            if (tds == null)
            {
                PageUtil.showToast(this, "数据异常!");
                return;
            }
            else if (tds.Tables[0].Rows.Count > 0)
            {
                PageUtil.showToast(this, "该出货单已进行过出货操作,暂不支持修改!");
                return;
            }
            try
            {
                DataSet ds = ship_dc.updateShip(ship_key, customer_id, part_no, request_qty, picked_qty);
                if (ds != null)
                {
                    updateTop_GridView(ds);
                    PageUtil.showToast(this, "修改成功!");
                }
                else
                {
                    PageUtil.showToast(this, "修改失败!");
                }
            }
            catch (Exception ex)
            {
                PageUtil.showToast(this, "修改失败!");
            }
        }