WarM/ÌõÂë´òÓ¡/Kf_WeighToBarCode_StationOutBill.cs
@@ -35,6 +35,7 @@
        public Int64 HProcessExchangeEntryID = 0;
        public Int64 HSupID = 0;
        public double HSourceQty = 0;
        public double HMaterWeight = 0;         //物料克重
        public string HCusMaterName = "";       //客户物料名称
        public string HCusModel = "";           //客户规格型号
        public string HMaker = DBUtility.ClsPub.CurUserName;
@@ -522,7 +523,7 @@
            if (chkHDYFlag.Checked == true)
            {
                //打印条码
                Sub_SetReport("物料条码");
                Sub_SetReport("半成品条码");
                Report.Print(false);
                Thread.Sleep(1000);
            }
@@ -542,6 +543,8 @@
            }
            txtHQty.Text = "";
            txtHWeightQyt.Text = "";
            txtHBarcodeNo.Text = "";
            txtHQty.Focus();
        }
@@ -574,12 +577,37 @@
                MessageBox.Show("请输入正确米数!", "提示");
                return false;
            }
            else if (DBUtility.ClsPub.isDoule(txtHWeightQyt.Text) == 0)
            {
                MessageBox.Show("请输入正确重量!", "提示");
                return false;
            }
            else if (DBUtility.ClsPub.isInt(txtHBarcodeNo.Text) == 0)
            {
                MessageBox.Show("请输入包号!", "提示");
                return false;
            }
            else if (DBUtility.ClsPub.isDoule(txtHProcID.Tag) == 0)
            {
                MessageBox.Show("请先选择工序!", "提示");
                return false;
            }
            //实际克重=重量/米数*1000,实际克重超出物料维护克重的百分之二十或不足物料维护克重的百分之八十,预警提示
            double sQty = 0;    //实际克重
            sQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text) / DBUtility.ClsPub.isDoule(txtHQty.Text) * 1000;
            if (sQty > HMaterWeight * 1.2 || sQty < HMaterWeight * 0.8)
            {
                if (MessageBox.Show("物料维护克重为:" + HMaterWeight.ToString() + ",实际克重为:" + sQty.ToString() + ",所输入实际克重超出物料维护克重的百分之二十或不足物料维护克重的百分之八十,请检查输入的数据是否正确!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
@@ -641,9 +669,11 @@
            string HBarCodeType = "";
            Int64 HMaterID2 = 0;
            double HQty = 0;            //米数
            double HMaterialJQty = 0;   //重量
            Int64 HGroupID = 0;
            Int64 HDeptID = 0;
            string HProcessExchangeBillNo = "";
            Int64 HBarcodeNo = 0;       //包数
            string HMaterName = "";
            string HMaterModel = "";
            Int64 HProcID = 0;
@@ -655,9 +685,11 @@
            HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text);
            HMaterID2 = DBUtility.ClsPub.isLong(txtHMaterNumber.Tag);
            HQty = DBUtility.ClsPub.isDoule(txtHQty.Text);
            HMaterialJQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text);
            HGroupID = DBUtility.ClsPub.isLong(txtHGroupID.Tag);
            HDeptID = DBUtility.ClsPub.isLong(txtHDeptName.Tag);
            HProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text);
            HBarcodeNo = DBUtility.ClsPub.isLong(txtHBarcodeNo.Text);
            HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text);
            HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text);
            HProcID = DBUtility.ClsPub.isLong(txtHProcID.Tag);
@@ -683,8 +715,8 @@
                + " '" + HBarCode + "','" + HBarCodeType + "'," + HMaterID2.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
                + ",'" + HBatchNo + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + HMaker + "',getdate(),0," + HQty.ToString()
                + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''"
                + ", 1,1," + HDeptID.ToString() + ",0,0,''"
                + ", 0,'',getdate(),'','" + sDate + "',0,0"
                + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + ",0,0,''"
                + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + ",0"
                + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0"
                + ", " + HProcessExchangeInterID.ToString() + "," + HProcessExchangeEntryID.ToString() + ",'" + HProcessExchangeBillNo + "',0,'" + HCusMaterName + "','" + HCusModel + "'"
                + ", " + HProcID.ToString() + "," + HCenterID.ToString() + "," + HSourceID.ToString() + "," + HProcNo.ToString() + "," + HSourceQty.ToString()
@@ -727,6 +759,7 @@
            HSourceQty = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("数量")].Value);
            HProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HProcessExchangeInterID")].Value);
            HSupID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSupID")].Value);
            HMaterWeight = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterWeight")].Value);
            HCusMaterName = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusMaterName")].Value);
            HCusModel = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusModel")].Value);
        }
@@ -928,6 +961,50 @@
        #endregion
        #region  //流水号扫描
        private void txtHProcNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                if (txtHProcNo.Text == "")
                {
                    MessageBox.Show("流水号为空,请输入流水号!");
                    return;
                }
                //根据转卡主ID、流水号带出流转卡上相应工序、班组、工作中心、生产资源
                DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetBCPWeighSource_HProcNo " + HProcessExchangeInterID.ToString() + "," + txtHProcNo.Text, "h_p_KF_GetBCPWeighSource_HProcNo");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    txtHProcNo.Text = "";
                    txtHProcID.Tag = 0;
                    txtHProcID.Text = "";
                    txtHCenterID.Tag = 0;
                    txtHCenterID.Text = "";
                    txtHGroupID.Tag = 0;
                    txtHGroupID.Text = "";
                    txtHSourceID.Tag = 0;
                    txtHSourceID.Text = "";
                    MessageBox.Show("所输入流水号不在当前工序流转卡下,请重新输入流水号!");
                    return;
                }
                else
                {
                    HProcessExchangeEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceEntryID"]);
                    txtHProcNo.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcNo"]);
                    txtHProcID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]);
                    txtHProcID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcName"]);
                    txtHCenterID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCenterID"]);
                    txtHCenterID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCenterName"]);
                    txtHGroupID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]);
                    txtHGroupID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HGroupName"]);
                    txtHSourceID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]);
                    txtHSourceID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
                }
            }
        }
        #endregion
        #region  //工序选择
        private void cmdHProcID_Click(object sender, EventArgs e)
@@ -970,5 +1047,106 @@
        }
        #endregion
        #region  //生产资源选择
        private void txtHSourceID_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Return)
            {
                if (DBUtility.ClsPub.isStrNull(txtHSourceID.Text) != "")
                {
                    DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();
                    if (oSource.GetInfoByID(DBUtility.ClsPub.isLong(txtHSourceID.Text.Replace("HCX", ""))))
                    {
                        txtHSourceID.Text = oSource.omodel.HName;
                        txtHSourceID.Tag = oSource.omodel.HItemID;
                    }
                    else
                    {
                        txtHSourceID.Text = "";
                        txtHSourceID.Tag = 0;
                    }
                }
                else
                {
                    txtHSourceID.Text = "";
                    txtHSourceID.Tag = 0;
                }
            }
        }
        private void txtHSourceID_Click(object sender, EventArgs e)
        {
            txtHSourceID.SelectAll();
        }
        private void txtHSourceID_TextChanged(object sender, EventArgs e)
        {
            BLL.ClsPub_BLL.Sub_ClearText(txtHSourceID);
        }
        private void cmdHSourceID_Click(object sender, EventArgs e)
        {
            DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();
            if (oSource.RefreshView())
            {
                txtHSourceID.Text = oSource.oModel.HName;
                txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
            }
            else
            {
                txtHSourceID.Text = "";
            }
        }
        #endregion
        #region  //生产班组选择
        private void cmdHGroupID_Click(object sender, EventArgs e)
        {
            DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View();
            if (oGroup.RefreshView())
            {
                txtHGroupID.Text = oGroup.oModel.HName;
                txtHGroupID.Tag = oGroup.oModel.HItemID.ToString();
            }
            else
            {
                txtHGroupID.Text = "";
            }
        }
        private void txtHGroupID_TextChanged(object sender, EventArgs e)
        {
            BLL.ClsPub_BLL.Sub_ClearText(txtHGroupID);
        }
        #endregion
        #region  //工作中心选择
        private void cmdHCenterID_Click(object sender, EventArgs e)
        {
            DAL.ClsGy_WorkCenter_View oWorkCenter = new DAL.ClsGy_WorkCenter_View();
            if (oWorkCenter.RefreshView())
            {
                txtHCenterID.Text = oWorkCenter.oModel.HName;
                txtHCenterID.Tag = oWorkCenter.oModel.HItemID.ToString();
            }
            else
            {
                txtHCenterID.Text = "";
            }
        }
        private void txtHCenterID_TextChanged(object sender, EventArgs e)
        {
            BLL.ClsPub_BLL.Sub_ClearText(txtHCenterID);
        }
        #endregion
    }
}