/// <summary> /// 抽包 /// </summary> /// <param name="qcinfoid"></param> private void getPackets(int qcinfoid, int did) { try { //DTS包号 List <string> listbags = QCInfoDAL.GetBags(qcinfoid); //总包数 DataTable dtNO_OF_BALES = LinQBaseDao.Query("select NO_OF_BALES from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + did).Tables[0]; string Packets_DTS = "";//DTS string类型包号 foreach (string item in listbags) { Packets_DTS += item + ","; } Packets_DTS = Packets_DTS.TrimEnd(','); Packets p = new Packets(); p.Packets_DTS = Packets_DTS; p.Packets_this = ""; p.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID = did; p.Packets_Time = DateTime.Now; PacketsDAL.InsertOneQCRecord(p); Common.GetSumWaterCount(qcinfoid); LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + Packets_DTS + "',QCInfo_PumpingPackets=" + Packets_DTS.Split(',').Count() + ",QCInfo_MOIST_Count=" + Common.SumWaterCount + " where QCInfo_ID=" + qcinfoid); } catch { } }
private void btn_CarAdd_Click(object sender, EventArgs e) { try { DRAW_EXAM_INTERFACE d = new DRAW_EXAM_INTERFACE(); QCInfo c = new QCInfo(); RegisterLoosePaperDistribution r = new RegisterLoosePaperDistribution(); Packets p = new Packets(); if (txt_SHIPMENT_NO.Text != "") { d.SHIPMENT_NO = txt_SHIPMENT_NO.Text.Trim(); } else { MessageBox.Show("送货单号不能为空"); return; } if (txt_PO_NO.Text != "") { d.PO_NO = txt_PO_NO.Text.Trim(); } else { MessageBox.Show("采购单号不能为空"); return; } if (cmb_PROD_ID.Text != "") { d.PROD_ID = cmb_PROD_ID.Text.Trim(); } else { MessageBox.Show("货品不能为空"); return; } if (txt_CNTR_NO.Text != "") { d.CNTR_NO = txt_CNTR_NO.Text.Trim(); } else { MessageBox.Show("车牌号不能为空"); return; } DataTable dt = LinQBaseDao.Query("select * from Unusualstandard where Unusualstandard_PROD ='" + cmb_PROD_ID.Text.Trim() + "' ").Tables[0]; if (dt != null && dt.Rows.Count > 0) { d.DEGRADE_MATERIAL_PERCT = Convert.ToDecimal(dt.Rows[0]["Unusualstandard_DEGRADE_MATERIAL_PERCT"]); d.DEGRADE_MOISTURE_PERCT = Convert.ToDecimal(dt.Rows[0]["Unusualstandard_DEGRADE_MOISTURE_PERCT"]); d.DEGRADE_OUTTHROWS_PERCT = Convert.ToDecimal(dt.Rows[0]["DEGRADE_OUTTHROWS_PERCT"]); } //过数表填写数据 d.COMPANY_ID = "9"; d.CREATE_DTTM = d.WEIGHT_DATE = DateTime.Now; d.WEIGHT_TICKET_NO = txt_WEIGHT_TICKET_NO.Text.Trim(); d.REF_NO = txt_REF_NO.Text.Trim(); d.NO_OF_BALES = Convert.ToInt32(txtsendNum.Text.Trim()); d.DRAW_ONE = 0; d.DRAW_TWO = 0; d.DRAW_THREE = 0; d.DRAW_FOUR = 0; d.DRAW_FIVE = 0; d.DRAW_SIX = 0; d.DRAW_7 = 0; d.DRAW_8 = 0; d.DRAW_9 = 0; d.DRAW_10 = 0; d.DRAW_11 = 0; d.DRAW_12 = 0; d.DRAW_13 = 0; d.DRAW_14 = 0; d.IS_FINISHED = "Y"; d.CREATE_BY = Common.USERNAME; //记录人:当前登录人 d.IS_DengJi = "Y"; d.FINISHED_BY = ""; d.FINISHED_DTTM = Convert.ToDateTime("1900 - 01 - 01 00:00:00"); d.RECV_RMA_METHOD = ""; d.TRANS_TO_WPIS_FLAG = "Y"; d.TRANS_TO_WPIS_DTTM = DateTime.Now; d.TRANS_TO_DTS_FLAG = ""; d.TRANS_TO_DTS_DTTM = Convert.ToDateTime("1900 - 01 - 01 00:00:00"); //d.IsSource = "手动"; string[] dtsList = txtchkNum.Text.Split(','); for (int i = 0; i < dtsList.Length; i++) { switch (i) { case 0: d.DRAW_ONE = Convert.ToInt32(dtsList[i]); break; case 1: d.DRAW_TWO = Convert.ToInt32(dtsList[i]); break; case 2: d.DRAW_THREE = Convert.ToInt32(dtsList[i]); break; case 3: d.DRAW_FOUR = Convert.ToInt32(dtsList[i]); break; case 4: d.DRAW_FIVE = Convert.ToInt32(dtsList[i]); break; case 5: d.DRAW_SIX = Convert.ToInt32(dtsList[i]); break; case 6: d.DRAW_7 = Convert.ToInt32(dtsList[i]); break; case 7: d.DRAW_8 = Convert.ToInt32(dtsList[i]); break; case 8: d.DRAW_9 = Convert.ToInt32(dtsList[i]); break; case 9: d.DRAW_10 = Convert.ToInt32(dtsList[i]); break; case 10: d.DRAW_11 = Convert.ToInt32(dtsList[i]); break; case 11: d.DRAW_12 = Convert.ToInt32(dtsList[i]); break; case 12: d.DRAW_13 = Convert.ToInt32(dtsList[i]); break; case 13: d.DRAW_14 = Convert.ToInt32(dtsList[i]); break; } } int result = 0; DRAW_EXAM_INTERFACEDAL.InsertOneCarInfo(d, out result); if (result > 0) { //MessageBox.Show("添加成功!"); //this.Close(); // LoadData(); //查询新增过数ID //质检登记成功填写数据 int result2 = 0; r.OrganizationID = "ChongQingPaper"; r.R_DRAW_EXAM_INTERFACE_ID = result; r.DepartmentCode = txtBuMen_Code.Text.Trim(); r.ExtensionField2 = txtDuiWei_code.Text.Trim(); r.issend = false; RegisterLoosePaperDistributionDAL.InsertOneCarInfo(r, out result2); //质检表填写数据 int result3 = 0; c.QCInfo_Dictionary_ID = 8; c.QCInfo_STATE = 2; c.QCInfo_DEGREE = 1; c.QCInfo_UnpackBefore_MOIST_PER_COUNT = 0; c.QCInfo_UnpackBack_MOIST_COUNT = 0; c.QCInfo_TIME = DateTime.Now; //日期时间 c.QCInfo_Client_ID = Common.CLIENTID; //客户端配置编号 c.QCInfo_UserId = EMEWE.Common.Converter.ToInt(Common.USERID); //记录人:当前登录人 c.QCInfo_DRAW_EXAM_INTERFACE_ID = result; c.QCInfo_PumpingPackets = dtsList.Length; c.QCInfo_DRAW = txtchkNum.Text.Trim(); if (dtsList.Length <= 4) { c.QCInfo_MOIST_Count = dtsList.Length * 8; } else { c.QCInfo_MOIST_Count = 32; } QCInfoDAL.InsertOneCarInfo(c, out result3); if (result > 0) { MessageBox.Show("添加成功!"); int result4 = 0; p.Packets_DTS = txtchkNum.Text.Trim(); p.Packets_this = "1"; p.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID = result; p.Packets_Time = DateTime.Now; PacketsDAL.InsertOneCarInfo(p, out result4); this.Close(); // LoadData(); } } } catch (Exception err) { } }
private void btnSave_Click(object sender, EventArgs e) { try { string Packets_this = ""; if (txtPack1.Text.Trim() != "") { Packets_this += txtPack1.Text.Trim() + ","; } if (txtPack2.Text.Trim() != "") { Packets_this += txtPack2.Text.Trim() + ","; } if (txtPack3.Text.Trim() != "") { Packets_this += txtPack3.Text.Trim() + ","; } if (txtPack4.Text.Trim() != "") { Packets_this += txtPack4.Text.Trim() + ","; } Packets_this = Packets_this.TrimEnd(','); string[] Packets_thisList = Packets_this.Split(','); string[] dtsList = lblPackets_DTS.Text.Split(','); foreach (string item in Packets_thisList) { foreach (string it in dtsList) { if (it == item) { MessageBox.Show("抽包号码“" + it + "”与DTS重复!"); return; } } } DataTable dtq = LinQBaseDao.Query("select QCInfo_ID from QCInfo where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text + " order by QCInfo_ID desc ").Tables[0]; if (dtq.Rows.Count > 0) { int moistcount = Convert.ToInt32(LinQBaseDao.GetSingle("select COUNT(0) from QCRecord where QCRecord_QCInfo_ID =" + dtq.Rows[0][0].ToString() + " and QCRecord_TestItems_ID in (1,3,4)")); if (moistcount > 0) { MessageBox.Show(this, "已开始测水,不能再抽包"); return; } } if (lblPackets_ID.Text.Trim() != "") { Expression <Func <Packets, bool> > fnP = n => n.Packets_ID == Convert.ToInt32(lblPackets_ID.Text.Trim()); Action <Packets> a = n => { n.Packets_this = Packets_this; }; if (PacketsDAL.Update(fnP, a)) { //抽包后修改qcinfo表 抽包总数和总抽包号 string bags = lblPackets_DTS.Text + "," + Packets_this; if (dtq.Rows.Count > 0) { Common.GetSumWaterCount(Convert.ToInt32(dtq.Rows[0][0].ToString())); LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + ",QCInfo_MOIST_Count=" + Common.SumWaterCount + " where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text); } else { LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + " where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text); } MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } LoadData(""); } } catch { } }