private void DoRepair() { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (((ValueInfo)this.cmbJointType.SelectedItem).ValueField != "") { if (((ValueInfo)this.cmbJointType.SelectedItem).ValueField.Equals("签名") && this.txtSignature.Text.Trim() == "") { throw new Exception(UtilCulture.GetString("Msg.R01020", UtilCulture.GetString("Label.R010763"))); } if (this.numFailedQty.Value > 0) { throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R01076"), "0")); } } if (this.numSuccessQty.Value == 0 && this.numFailedQty.Value == 0) { throw new Exception(UtilCulture.GetString("Msg.R01017", UtilCulture.GetString("Label.R01075"), UtilCulture.GetString("Label.R01076"))); } if ((this.numSuccessQty.Value + this.numFailedQty.Value) > RepairStock.curpairqty) { throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R01075") + "+" + UtilCulture.GetString("Label.R01076"), UtilCulture.GetString("Label.R01074"))); } tinprepairstock repairstock = new tinprepairstock(); repairstock.customerid = RepairStock.customerid; repairstock.custorderno = this.txtCustOrderNo.Text; repairstock.styleno = this.txtStyleNo.Text; repairstock.color = this.txtColor.Text; repairstock.size = this.txtSize.Text; repairstock.checktype = RepairStock.checktype; repairstock.ttlpairgoodqty = this.numSuccessQty.Value; repairstock.ttlbadqty = this.numFailedQty.Value; repairstock.step = ((ValueInfo)this.cmbToStep.SelectedItem).ValueField; repairstock.workgroup = ((ValueInfo)this.cmbWorkGroup.SelectedItem).ValueField; List<tinprepairfail> lstreasoncode = new List<tinprepairfail>(); foreach (UltraGridRow row in this.grdDetail.Rows) { if (row.Cells["ck"].Value.ToString().Equals("Y")) { if (Convert.ToDecimal(row.Cells["pairqty"].Value) == 0) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R010761"))); } tinprepairfail repairfail = new tinprepairfail(); repairfail.reasoncode = row.Cells["reasoncode"].Value.ToString(); repairfail.remark = row.Cells["remark"].Value.ToString(); repairfail.pairqty = Convert.ToDecimal(row.Cells["pairqty"].Value); lstreasoncode.Add(repairfail); } } client.DoRepairBack(baseForm.CurrentContextInfo, repairstock, lstreasoncode.ToArray<tinprepairfail>(), ((ValueInfo)this.cmbJointType.SelectedItem).ValueField,this.txtSignature.Text.Trim()); baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002")); this.Close(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }