public void LoadAreaList(string sWHId) { string sErr = ""; string sSql = "select * from TWC_WArea where bUsed=1 and cWHId='" + sWHId + "'"; DataSet dstt = null; Cursor.Current = Cursors.WaitCursor; try { dstt = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "data", 0, 0, "", out sErr); } catch (Exception err) { Cursor.Current = Cursors.Default; MessageBox.Show(err.Message); return; } Cursor.Current = Cursors.Default; if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); return; } if (dstt != null) { DataTable tbX = dstt.Tables["data"]; cmb_cAreaId.DisplayMember = "cAreaName"; cmb_cAreaId.ValueMember = "cAreaId"; cmb_cAreaId.DataSource = tbX; cmb_cAreaId.SelectedIndex = -1; } }
/// <summary> /// 判断物料编码是否合法 /// </summary> /// <param name="sMNo"></param> /// <returns></returns> private bool JudgeMNoIsOK(string sMNo) { bool bOK = false; string sSql = "select count(*) nCount from TPC_Material where cMNo='" + sMNo.Trim() + "'"; string sErr = ""; object objX = null; if (DBFuns.GetValueBySql(AppInformation.SvrSocket, sSql, "", "nCount", out objX, out sErr)) { if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); return(false); } else { if (objX == null) { bOK = false; } else { bOK = objX.ToString() == "1"; } } } else { bOK = false; } return(bOK); }
private void OpenDataList() { string sErr = ""; StringBuilder builder = new StringBuilder(this.sSql); if (base.UserInformation.UType != UserType.utSupervisor) { builder.Append(" and isnull(b.cChecker,'') in (select cName from TPB_User where cDeptId='" + base.UserInformation.DeptId + "')"); } if (this.txt_BillNo.Text.Trim() != "") { builder.Append(" and b.cBNo like '%" + this.txt_BillNo.Text.Trim() + "%'"); } if (this.txt_MatName.Text.Trim() != "") { builder.Append(" and ( dtl.cMNo like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cName,'') like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cWBJM,'') like '%" + this.txt_MatName.Text.Trim() + "%' "); builder.Append(" or isnull(mat.cPYJM,'') like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cSpec,'') like '%" + this.txt_MatName.Text.Trim() + "%'"); builder.Append(")"); } DataSet set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, builder.ToString(), "tbBillDtl", 0, 0, "", out sErr); if (((set != null) && (sErr.Trim() != "")) && (sErr.Trim() != "0")) { MessageBox.Show(sErr); } else { this.grd_Data.DataSource = set.Tables["tbBillDtl"]; this.lbl_DataCount.Text = set.Tables["tbBillDtl"].Rows.Count.ToString(); } }
private void BindCType1Data() { /*select CTYPEID,CTYPENAME from TPC_MATERIALTYPE*/ string sErr = ""; string sSql = string.Format("select CTYPEID,CTYPENAME from TPC_MATERIALTYPE"); DataSet dstt = null; try { dstt = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "data", 0, 0, "", out sErr); } catch (Exception err) { MessageBox.Show(err.Message); return; } if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); return; } if (dstt != null) { DataTable tbX = dstt.Tables["data"]; cmb_cTypeId1.DisplayMember = "CTYPENAME"; cmb_cTypeId1.ValueMember = "CTYPEID"; cmb_cTypeId1.DataSource = tbX; cmb_cTypeId1.SelectedIndex = -1; } }
private void LoadBaseItem() { #region string sBClass = ""; if (_IsInBill) { sBClass = "1"; } else { sBClass = "2"; } string sSql = "select cBTypeId,cBType,nBClass from tpb_billtype where nBClass=" + sBClass + " and bUsed=1 order by nSort,cBTypeId"; #endregion DataSet dsX = null; string sErr = ""; #region 单据类型 dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "btype", 0, 0, "", out sErr); if (sErr.Trim() != "0" && sErr.Trim() != "") { MessageBox.Show(sErr); return; } DataTable tbBType = dsX.Tables["btype"].Copy(); if (tbBType != null) { cmb_BillType.DisplayMember = "cBType"; cmb_BillType.ValueMember = "cBTypeId"; cmb_BillType.DataSource = tbBType; return; } #endregion #region 供货部门 if (_IsInBill) { sSql = "select cCSId,cCSNameJ from TPB_CuSupplier where nType=0 and bUsed=1"; } else { sSql = "select cCSId,cCSNameJ from TPB_CuSupplier where nType=1 and bUsed=1"; } dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "TPB_CuSupplier", 0, 0, "", out sErr); if (sErr.Trim() != "0" && sErr.Trim() != "") { MessageBox.Show(sErr); return; } DataTable tbCuSupplier = dsX.Tables["TPB_CuSupplier"].Copy(); if (tbCuSupplier != null) { cmb_Dept.DisplayMember = "cCSNameJ"; cmb_Dept.ValueMember = "cCSNameJ"; cmb_Dept.DataSource = tbCuSupplier; return; } #endregion }
private void txt_Dtl_cBatchNo_Enter(object sender, EventArgs e) { if (txt_Dtl_cMNo.Text.Trim() != "" && bIsNew && (_BType.Trim() != "102" && _BType.Trim() != "103" && _BType.Trim() != "104") && txt_Dtl_cBatchNo.Text.Trim() == "") { dtp_Dtl_dProdDate_Leave(null, null); string sErr = ""; txt_Dtl_cBatchNo.Text = DBFuns.sp_GetBatchNo(AppInformation.SvrSocket, txt_Dtl_cMNo.Text.Trim(), dtp_Dtl_dProdDate.Value.ToString("yyyy-MM-dd"), out sErr); if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); } txt_Dtl_cBatchNo.SelectAll(); } }
private bool isBillOK() { string sSql = string.Format("select nbillstatus from TWB_BillIn where cBNo='{0}'", sBNo); if (DBFuns.GetValueBySql(AppInformation.SvrSocket, sSql, "", "nbillstatus", out objValue, out sErr)) { if (objValue != null && objValue.ToString() != "" && (sErr.Trim() == "" || sErr.Trim() == "0")) { if (Convert.ToInt32(objValue) == 1) { return(true); } } } return(false); }
private void LoadOptNoList(string sWHId, string sOptGroup, int nRow) { int num = 0; if (nRow > 0) { num = nRow; } num = (num + 1) / 2; string sSql = "select nOptNo from TECS_HSInfo where 1=1 "; if (sWHId.Trim() != "") { sSql = sSql + " and cWHId='" + sWHId.Trim() + "'"; } if (sOptGroup.Trim() != "") { sSql = sSql + " and cGroupName='" + sOptGroup.Trim() + "'"; } if (num > 0) { sSql = sSql + " and nLine=" + num.ToString(); } string sErr = ""; DataSet set = null; set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "OptNo", 0, 0, "", out sErr); if ((sErr.Trim() != "") && (sErr.Trim() != "0")) { MessageBox.Show(sErr); } else if (set != null) { DataTable table = set.Tables["OptNo"]; if (table != null) { this.cmb_Port.DisplayMember = "nOptNo"; this.cmb_Port.ValueMember = "nOptNo"; this.cmb_Port.DataSource = table; if (this.cmb_Port.Items.Count > 0) { this.cmb_Port.SelectedIndex = 0; } } } }
private void LoadOptGroup(string sWHId) { string sSql = "select distinct cGroupName from TECS_HSInfo "; if (sWHId.Trim() != "") { sSql = sSql + " where cWHId='" + sWHId.Trim() + "'"; } string sErr = ""; DataSet set = null; set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "OptGroup", 0, 0, "", out sErr); if ((sErr.Trim() != "") && (sErr.Trim() != "0")) { MessageBox.Show(sErr); } else if (set != null) { DataTable table = set.Tables["OptGroup"]; if (table != null) { this.cmb_OptGroup.DisplayMember = "cGroupName"; this.cmb_OptGroup.ValueMember = "cGroupName"; this.cmb_OptGroup.DataSource = table; string sValue = ""; if (MyConfigure.ReadMyArributeValue(base.AppInformation.AppPath + @"\" + base.AppInformation.AppConfigFile, "config/ECS/OptGroup", "Default", out sValue, out sErr)) { if (this.cmb_OptGroup.Items.Count > 0) { if (sValue.Trim() != "") { this.cmb_OptGroup.SelectedValue = sValue; } else { this.cmb_OptGroup.SelectedIndex = 0; } } } else if (this.cmb_OptGroup.Items.Count > 0) { this.cmb_OptGroup.SelectedIndex = 0; } } } }
private void btn_Dtl_InnerAccont_Click(object sender, EventArgs e) { if (isBillOK()) { sSql = "select count(0) num from TWB_WorkTaskDtl where cBNo='" + sBNo + "' and nItem=" + nItem.ToString() + " and nWorkId in (select nWorkId from TWB_WorkTask where nWKStatus <99)"; if (DBFuns.GetValueBySql(AppInformation.SvrSocket, sSql, "", "num", out objValue, out sErr)) { if (objValue != null && objValue.ToString() != "" && (sErr.Trim() == "" || sErr.Trim() == "0")) { if (Convert.ToInt32(objValue) == 0) { if (MessageBox.Show("确定整单无差异登记吗?", "WMS", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { int count = 0; int badcount = 0; foreach (DataGridViewRow item in dataGridView_HasPallet.Rows) { int pWorkId = Convert.ToInt32(item.Cells["nWorkId"].Value); if (PubDBCommFuns.sp_DoAccont(base.AppInformation.SvrSocket, pWorkId, 1, "WMS", out sErr) == "0") { count++; } else { badcount++; } } DoRefreshQty(); DoRefreshHasPallet(); MessageBox.Show("成功登记了 " + count.ToString() + " 条任务,失败" + badcount.ToString() + " 条任务!"); } } else { MessageBox.Show("对不起,该订单下还有没有上架完成的任务!"); } } } } else { MessageBox.Show("对不起,还没有收到PSCS发过来的收货入库单!"); } }
private int GetPosRowNo(string sPosId) { int num = 0; string sSql = "select nRow from TWC_WareCell where cPosId='" + sPosId.Trim() + "'"; object objValue = null; string sErr = ""; if (DBFuns.GetValueBySql(base.AppInformation.SvrSocket, sSql, "", "nRow", out objValue, out sErr)) { if (objValue != null) { num = Convert.ToInt16(objValue); } return(num); } MessageBox.Show("获取货位的行号时出错:" + sErr); return(num); }
private void DoRefreshQty() { sSql = "select fqty,fpallet,ffinished from TWB_BillInDtl where cBNo='" + sBNo + "' and nItem=" + nItem.ToString(); DataSet ds = PubDBCommFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "TWB_BillInDtl", 0, 0, "", out sErr); if (sErr.Length > 0) { MessageBox.Show(sErr); } else if (ds == null) { MessageBox.Show("对不起,打开单据表数据失败!"); } else { DataRow dr = ds.Tables["TWB_BillInDtl"].Rows[0]; fqty = Convert.ToDouble(dr["fqty"]); lbfqty.Text = fqty.ToString(); string fpalletStr = dr["fpallet"].ToString(); fpalletStr = fpalletStr == "" ? "0" : fpalletStr; fpallet = Convert.ToDouble(fpalletStr); lbfpallet.Text = fpallet.ToString(); ffinished = Convert.ToDouble(dr["ffinished"]); lbffinished.Text = ffinished.ToString(); } sSql = "select sum(fQty) fQty from TWB_WorkTaskDtl where cBNo='" + sBNo + "' and nItem=" + nItem.ToString() + " and nWorkId in (select nWorkId from TWB_WorkTask where nWKStatus in (99,109))"; if (DBFuns.GetValueBySql(AppInformation.SvrSocket, sSql, "", "fQty", out objValue, out sErr)) { if (objValue != null && objValue.ToString() != "" && (sErr.Trim() == "" || sErr.Trim() == "0")) { taskFinNum = Convert.ToDouble(objValue); lbtaskFinNum.Text = taskFinNum.ToString(); } } }
private void btn_Query_Click(object sender, EventArgs e) { if (dtp_From.Value > dtp_To.Value) { MessageBox.Show("对不起,开始时间不能大于截止时间!"); dtp_From.Focus(); return; } string sDesc = ""; string sErr = ""; string sSql = sSqlStr + GetCondition(out sDesc); DataSet dsX = null; try { dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "ioDetail", 0, 0, "dDate", out sErr); } catch (Exception err) { MessageBox.Show(err.Message); return; } if (sErr.Trim() != "" && sErr.Trim() != "0") { MessageBox.Show(sErr); return; } if (dsX == null) { return; } DataTable tbX = dsX.Tables["ioDetail"]; bds_List.DataSource = tbX; grd_List.DataSource = bds_List; lbl_Count.Text = bds_List.Count.ToString(); }
private void mi_EditStoreQty_Click(object sender, EventArgs e) { if (bdsList.Count == 0) { MessageBox.Show("对不起,无库存数据可修改!"); return; } DataRowView drv = null; drv = (DataRowView)bdsList.Current; if (drv == null) { return; } string sPosId = btnCurr.Tag.ToString(); //MessageBox.Show(sPosId); string sPalletId = drv["nPalletId"].ToString(); string sBoxId = drv["cBoxId"].ToString(); string sBNoIn = drv["cBNoIn"].ToString(); string sItemIn = drv["nItemIn"].ToString(); string sWHId = drv["cWHId"].ToString(); string sMNo = drv["cItemId"].ToString(); string sBatchNo = drv["cBatchNo"].ToString(); string sWHIdErp = drv["cWHIdErp"].ToString(); string sAreaIdErp = drv["cAreaIdErp"].ToString(); string sPosIdErp = drv["cPosIdErp"].ToString(); double fQty = 0; fQty = Convert.ToDouble(drv["fQty"]); string sReal = ""; double fReal = 0; if (UI.UIPubMethode.InputMessage("请录入实际库存数量:", "修改库存数量", fQty.ToString(), UI.InputMsgType.ittReal, out sReal)) { fReal = double.Parse(sReal); } else { return; } if (fReal < 0) { MessageBox.Show("对不起,修改的数量不能为负数!"); return; } string sErr = ""; if (MessageBox.Show("您确定要将库存数量:" + fQty.ToString() + " 改为:" + fReal.ToString() + " 吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { string sId = DBFuns.SP_Ajust_UpdateStoreQty(AppInformation.SvrSocket, UserInformation.UserId, UserInformation.UnitId, "WMS", sPalletId, sBoxId, sMNo, fReal, sBNoIn, sItemIn, sBNoAjust, out sErr); if (sId.Trim() == "B") { sBNoAjust = sErr; MessageBox.Show("已修改成功,请注意审核调整单:" + sBNoAjust); } else { MessageBox.Show(sErr); } } }
private bool QueryStoreDtlList() { StringBuilder sCon = new StringBuilder(""); StringBuilder sSql = new StringBuilder(""); sSql.Append("select st.cItemId cMNo,st.cMName,st.cSpec,st.cMatStyle,st.cMatQCLevel,st.cMatOther,st.cRemark,st.cBatchNo,st.fQty,st.cUnit,"); sSql.Append(" st.dProdDate,st.dBadDate,st.cDtlCSId,st.cDtlSupplier,st.cStoreRemark,st.cBNoIn,st.nItemIn,st.nQCStatus,st.cQCStatus, "); sSql.Append(" wc.nPalletId,wc.cPosId,wc.cWHId,wc.cAreaId,wa.cAreaName,st.cABC,wh.cName cWHName from V_StoreItemList st "); sSql.Append(" left join TWC_WareCell wc on st.nPalletId=isnull(wc.nPalletId,' ') "); sSql.Append(" left join TWC_Warehouse wh on wc.cWHId=wh.cWHId "); sSql.Append(" left join TWC_WArea wa on wc.cAreaId=wa.cAreaId"); #region 条件 #region if (cmb_cWHId.Text.Trim() != "" && cmb_cWHId.SelectedValue != null && cmb_cWHId.SelectedIndex > -1) { if (sCon.Length > 0) { sCon.Append(" and isnull(wc.cWHId,' ')='" + cmb_cWHId.SelectedValue.ToString() + "'"); } else { sCon.Append(" where isnull(wc.cWHId,' ')='" + cmb_cWHId.SelectedValue.ToString() + "'"); } } if (cmb_cAreaId.Text.Trim() != "" && cmb_cAreaId.SelectedValue != null && cmb_cAreaId.SelectedIndex > -1) { if (sCon.Length > 0) { sCon.Append(" and isnull(wc.cAreaId,' ')='" + cmb_cAreaId.SelectedValue.ToString() + "'"); } else { sCon.Append(" where isnull(wc.cAreaId,' ')='" + cmb_cAreaId.SelectedValue.ToString() + "'"); } } if (txtPalletId.Text.Trim() != "") { string sPalletId = txtPalletId.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and st.nPalletId like '%" + sPalletId + "'"); } else { sCon.Append(" where st.nPalletId like '%" + sPalletId + "'"); } } if (this.txt_cPosId.Text.Trim() != "") { string sPosId = txt_cPosId.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and isnull(wc.cPosId,' ') like '%" + sPosId + "'"); } else { sCon.Append(" where isnull(wc.cPosId,' ') like '%" + sPosId + "'"); } } #endregion int nX = 0; #region if (txt_cName.Text.Trim() != "") { string sX = txt_cName.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and ((isnull(st.cMNo,'~') like '%" + sX + "%') or (isnull(st.cMName,'~') like '%" + sX + "%') or (isnull(st.cWBJM,'~') like '%" + sX + "%') or (isnull(st.cPYJM,'~') like '%" + sX + "%') )"); } else { sCon.Append(" where ((isnull(st.cMNo,'~') like '%" + sX + "%') or (isnull(st.cMName,'~') like '%" + sX + "%') or (isnull(st.cWBJM,'~') like '%" + sX + "%') or (isnull(st.cPYJM,'~') like '%" + sX + "%') )"); } } if (txt_cBatchNo.Text.Trim() != "") { string sX = txt_cBatchNo.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cBatchNo,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cBatchNo,'~') like '%" + sX + "%')"); } } if (this.txt_cSpec.Text.Trim() != "") { string sX = txt_cSpec.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cSpec,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cSpec,'~') like '%" + sX + "%')"); } } if (this.txt_cRemark.Text.Trim() != "") { string sX = txt_cRemark.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cRemark,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cRemark,'~') like '%" + sX + "%')"); } } if (this.txt_cMatStyle.Text.Trim() != "") { string sX = txt_cMatStyle.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cMatStyle,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cMatStyle,'~') like '%" + sX + "%')"); } } if (this.txt_cMatQCLevel.Text.Trim() != "") { string sX = txt_cMatQCLevel.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cMatQCLevel,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cMatQCLevel,'~') like '%" + sX + "%')"); } } if (this.txt_cMatOther.Text.Trim() != "") { string sX = txt_cMatOther.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cMatOther,'~') like '%" + sX + "%')"); } else { sCon.Append(" where (isnull(st.cMatOther,'~') like '%" + sX + "%')"); } } if (cmb_cABC.Text.Trim() != "") { string sX = cmb_cABC.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cABC,'~') = '" + sX + "')"); } else { sCon.Append(" where (isnull(st.cABC,'~') = '" + sX + "')"); } } #endregion #region if (cmb_cTypeId1.Text.Trim() != "" && cmb_cTypeId1.SelectedValue != null && cmb_cTypeId1.SelectedIndex > -1) { if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cTypeId1,'~') like '%" + cmb_cTypeId1.SelectedValue.ToString() + "%')"); } else { sCon.Append(" where (isnull(st.cTypeId1,'~') like '%" + cmb_cTypeId1.SelectedValue.ToString() + "%')"); } } if (cmb_cABC.Text.Trim() != "") { string sX = cmb_cABC.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cABC,'~') like '%" + sX + "%') "); } else { sCon.Append(" where (isnull(st.cABC,'~') like '%" + sX + "%') "); } } if (this.txt_cSupplier.Text.Trim() != "") { string sX = txt_cSupplier.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and ((isnull(st.cDtlCSId,'~') like '%" + sX + "%') or (isnull(st.cDtlSupplier,'~') like '%" + sX + "%') or (isnull(st.cDtlWBJM,'~') like '%" + sX + "%') or (isnull(st.cDtlPYJM,'~') like '%" + sX + "%'))"); } else { sCon.Append(" where ((isnull(st.cDtlCSId,'~') like '%" + sX + "%') or (isnull(st.cDtlSupplier,'~') like '%" + sX + "%') or (isnull(st.cDtlWBJM,'~') like '%" + sX + "%') or (isnull(st.cDtlPYJM,'~') like '%" + sX + "%'))"); } } if (txt_cDtlRemark.Text.Trim() != "") { string sX = txt_cDtlRemark.Text.Trim(); if (sCon.Length > 0) { sCon.Append(" and (isnull(st.cDtlRemark,'~') like '%" + sX + "%') "); } else { sCon.Append(" where (isnull(st.cDtlRemark,'~') like '%" + sX + "%') "); } } #endregion #endregion sSql.Append(sCon.ToString()); bool bIsOK = false; //if (DBDataSet.Tables["TWC_WareCell"] != null) // DBDataSet.Tables["TWC_WareCell"].Clear(); grdData.AutoGenerateColumns = false; string sErr = ""; //string sql = "select * from V_WareCellStatus " + strCon; //string sX = BI.BSIOBillBI.BSIOBillBI.QueryCellList(AppInformation.dbtApp, AppInformation.AppConn, DBDataSet, UserInformation, strCon); DataSet ds = null; Cursor.Current = Cursors.WaitCursor; try { dsX.Clear(); dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql.ToString(), "StockDtl", 0, 0, "", out sErr); } catch (Exception err) { Cursor.Current = Cursors.Default; MessageBox.Show(err.Message); return(false); } Cursor.Current = Cursors.Default; bIsOK = sErr == ""; sSql.Remove(0, sSql.Length); sCon.Remove(0, sCon.Length); if (bIsOK == true) { grdData.Focus(); grdData.DataSource = dsX.Tables["StockDtl"]; } else { MessageBox.Show(sErr); } return(bIsOK); }
private void btnOK_Click(object sender, EventArgs e) { string strBId = ""; strBId = drvItem["cBNo"].ToString(); string sCSId = txt_Dtl_cCSId.Text.Trim(); string sSupplier = txt_Dtl_cSupplier.Text.Trim(); string sErr = ""; //检测是否录入全 if (txt_Dtl_cMNo.Text.Trim() == "") { MessageBox.Show("对不起,物料编码不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_Dtl_cMNo.Focus(); return; } if (!JudgeMNoIsOK(txt_Dtl_cMNo.Text.Trim())) { MessageBox.Show("对不起,录入有误,物料编码不存在!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_Dtl_cMNo.SelectAll(); txt_Dtl_cMNo.Focus(); return; } if (this.txt_Dtl_fQty.Text.Trim() == "") { MessageBox.Show("对不起,物料数量不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_Dtl_fQty.Focus(); return; } if (!IsNumberic(txt_Dtl_fQty.Text.Trim())) { MessageBox.Show("对不起,物料数量为非法数值!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_Dtl_fQty.SelectAll(); txt_Dtl_fQty.Focus(); return; } if (double.Parse(txt_Dtl_fQty.Text.Trim()) == 0) { MessageBox.Show("对不起,数量不能为0"); txt_Dtl_fQty.SelectAll(); txt_Dtl_fQty.Focus(); return; } if (txt_Dtl_cUnit.Text.Trim() == "") { MessageBox.Show("对不起,单位不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_Dtl_cUnit.SelectAll(); txt_Dtl_cUnit.Focus(); return; } if (txt_Dtl_cBatchNo.Text.Trim() == "") { MessageBox.Show("对不起,批号不能为空!"); txt_Dtl_cBatchNo.SelectAll(); txt_Dtl_cBatchNo.Focus(); return; } if (bIsNew) { dtp_Dtl_dBadDate.Value = dtp_Dtl_dProdDate.Value.AddDays(GetMaterialKeepDay(txt_Dtl_cMNo.Text.Trim())); } switch (_BClass) { case 11: //入库验收单 #region if (this.txt_Dtl_fAccept.Text.Trim() == "") { MessageBox.Show("对不起,入库验收的到货数量不能为空!"); txt_Dtl_fAccept.Focus(); return; } if (!IsNumberic(this.txt_Dtl_fAccept.Text.Trim())) { MessageBox.Show("对不起,入库验收的到货数量录入有误,请录入正确的数量!"); txt_Dtl_fAccept.SelectAll(); txt_Dtl_fAccept.Focus(); return; } if (this.txt_Dtl_fOK.Text.Trim() == "") { MessageBox.Show("对不起,入库验收的合格数量不能为空!"); txt_Dtl_fOK.Focus(); return; } if (!IsNumberic(this.txt_Dtl_fOK.Text.Trim())) { MessageBox.Show("对不起,入库验收的合格数量录入有误,请录入正确的数量!"); txt_Dtl_fOK.SelectAll(); txt_Dtl_fOK.Focus(); return; } if (this.txt_Dtl_fBad.Text.Trim() == "") { MessageBox.Show("对不起,入库验收的不合格数量不能为空!"); txt_Dtl_fBad.Focus(); return; } if (!IsNumberic(this.txt_Dtl_fBad.Text.Trim())) { MessageBox.Show("对不起,入库验收的不合格数量录入有误,请录入正确的数量!"); txt_Dtl_fBad.SelectAll(); txt_Dtl_fBad.Focus(); return; } if (double.Parse(txt_Dtl_fBad.Text.Trim()) < 0) { MessageBox.Show("对不起,入库验收的到合格数量不能大于到货数量!"); txt_Dtl_fOK.SelectAll(); txt_Dtl_fOK.Focus(); return; } if (double.Parse(txt_Dtl_fAccept.Text.Trim()) != (double.Parse(txt_Dtl_fOK.Text.Trim()) + double.Parse(txt_Dtl_fBad.Text.Trim()))) { MessageBox.Show("对不起,入库验收的到货数量 不等于 合格数量 加上 不合格数量!"); txt_Dtl_fAccept.SelectAll(); txt_Dtl_fAccept.Focus(); } #endregion break; } //退货入库的情况 if (_BType.Trim() == "102" || _BType.Trim() == "1102") { if (DBFuns.sp_CheckBackInDtl(AppInformation.SvrSocket, strBId, _BClass, txt_Dtl_cMNo.Text.Trim(), txt_Dtl_cBatchNo.Text.Trim(), double.Parse(txt_Dtl_fQty.Text.Trim()), txt_Dtl_cFromNo.Text.Trim(), out sErr) == "-1") { MessageBox.Show(sErr); txt_Dtl_fQty.SelectAll(); txt_Dtl_fQty.Focus(); return; } } if (txt_Dtl_cCSId.Text.Trim() == "" && nMatClass != 0) { MessageBox.Show("对不起,供应商或生产商不能为空,请选择!"); return; } UIToDataRowView(drvItem, pnlDtlEdit); if (_BClass == 11) { UIToDataRowView(drvItem, grp_BackIn); UIToDataRowView(drvItem, grp_ChkIn); } if (bIsNew == true) //新增的情况 { bIsResultOK = true; nQCState = GetMaterialQCState(drvItem["cMNo"].ToString().Trim()); drvItem.BeginEdit(); if (_BClass == 1) { drvItem["nQCStatus"] = nQCState; } drvItem.EndEdit(); bIsShowGrid = false; DataRowViewToUI(drvItem, pnlDtlEdit); bIsShowGrid = true; drvItem["nItem"] = GetNewItem(strBId); if (_BType.Trim().ToLower() != "102" && _BType.Trim().ToLower() != "1102") //退货入库 { drvItem["cBNoIn"] = drvItem["cBNo"]; drvItem["nItemIn"] = drvItem["nItem"]; } string sql = ""; if (_BClass == 11) { sql = DBCommInfo.DBSQLCommandInfo.GetSQLByDataRow(drvItem, "TWB_BillChkAcceptDtl", "cBNo,nItem", "cMName,cSpec,cQCStatus,cPStatus,cMatStyle,cMatQCLevel,cMatOther,cMRemark", true); } else { sql = DBCommInfo.DBSQLCommandInfo.GetSQLByDataRow(drvItem, "TWB_BillInDtl", "cBNo,nItem", "cMName,cSpec,cQCStatus,cPStatus,cMatStyle,cMatQCLevel,cMatOther", true); } string err = ""; DataSet ds = PubDBCommFuns.GetDataBySql(sql, DBCommInfo.DBSQLCommandInfo.GetFieldsForDate(drvItem), out err); bIsResultOK = ds.Tables[0].Rows[0][0].ToString() == "0"; //this.Close(); if (bIsResultOK) { MessageBox.Show("增加明细成功!"); bIsNew = true; ClearUIValues(pnlDtlEdit); drvItem["cBNo"] = strBId; drvItem["cMNo"] = ""; DataRowViewToUI(drvItem, pnlDtlEdit); txt_Dtl_cSupplier.Text = sSupplier; txt_Dtl_cCSId.Text = sCSId; txt_Dtl_cMNo.SelectAll(); txt_Dtl_cMNo.Focus(); } } else //修改 { bIsShowGrid = false; DataRowViewToUI(drvItem, pnlDtlEdit); bIsShowGrid = true; string sql = ""; if (_BClass == 11) { sql = DBCommInfo.DBSQLCommandInfo.GetSQLByDataRow(drvItem, "TWB_BillChkAcceptDtl", "cBNo,nItem", "cMName,cSpec,cQCStatus,cPStatus,cMatStyle,cMatQCLevel,cMatOther,cMRemark", false); } else { sql = DBCommInfo.DBSQLCommandInfo.GetSQLByDataRow(drvItem, "TWB_BillInDtl", "cBNo,nItem", "cMName,cSpec,cQCStatus,cPStatus,cMatStyle,cMatQCLevel,cMatOther", false); } string err = ""; DataSet ds = PubDBCommFuns.GetDataBySql(sql, DBCommInfo.DBSQLCommandInfo.GetFieldsForDate(drvItem), out err); bIsResultOK = ds.Tables[0].Rows[0][0].ToString() == "0"; this.Close(); } }
private void btn_OK_Click(object sender, EventArgs e) { string pWHId = ""; string pAreaId = ""; string pOptGroup = ""; int pIsSameBatchNo = 0; int pIsEmptAsWholeOut = 0; if (((this.cmb_cWHId.Text.Trim() == "") || (this.cmb_cWHId.SelectedValue == null)) || (this.cmb_cWHId.SelectedValue.ToString().Trim() == "")) { MessageBox.Show("请选择仓库!"); this.cmb_cWHId.Focus(); } else if (this.cmb_OptGroup.Text.Trim() == "") { MessageBox.Show("请录入操作台组别!"); this.cmb_OptGroup.Focus(); } else { pWHId = this.cmb_cWHId.SelectedValue.ToString(); if ((this.cmb_cAreaId.Text.Trim() != "") && (this.cmb_cAreaId.SelectedValue != null)) { pAreaId = this.cmb_cAreaId.SelectedValue.ToString(); } if (this.chk_EmptyAsWholeOut.Checked) { pIsEmptAsWholeOut = 1; } if (this.chk_SameBatchNo.Checked) { pIsSameBatchNo = 1; } pOptGroup = this.cmb_OptGroup.SelectedValue.ToString(); string sErr = ""; int count = this.grd_Data.SelectedRows.Count; if (count == 0) { MessageBox.Show("请选择所要配盘的待配数据!"); this.grd_Data.Focus(); } else { this.prg_Data.Maximum = count; this.prg_Data.Minimum = 0; this.prg_Data.Value = 0; this.prg_Data.Visible = true; count = 0; foreach (DataGridViewRow row in this.grd_Data.SelectedRows) { if (DBFuns.SP_Pack_DoPltDtlOutAuto(base.AppInformation.SvrSocket, base.UserInformation.UserId, base.UserInformation.UnitId, "WMS", row.Cells["col_cBNo"].Value.ToString(), row.Cells["col_nItem"].Value.ToString(), pWHId, pAreaId, pIsSameBatchNo, pIsEmptAsWholeOut, pOptGroup, out sErr) == "0") { count++; } this.prg_Data.Value++; } MessageBox.Show("成功自动配盘了 " + count.ToString() + " 条待配盘数据,请刷新配盘数据,以便完成剩余待配数据!"); this.OpenDataList(); } } }