1
duhe
2023-08-07 9ae6aa786445d49dc3e93ead5a8ee4b92006304e
WarM/ÌõÂë´òÓ¡/Kf_WeighToBarCode.cs
@@ -38,6 +38,7 @@
        public Int64 ProcessExchangeInterID = 0;
        public Int64 HSupID = 0;
        public double HSourceQty = 0;
        public double HMaterWeight = 0;         //物料克重
        public string HMaker = DBUtility.ClsPub.CurUserName;
        public Int64 HStockOrgID = DBUtility.ClsPub.HOrgID;
        public DateTime HDate = DateTime.Today;
@@ -313,8 +314,8 @@
            bool b = false;
            for (int i = 0; i < grdMain.RowCount; i++)
            {
                    b = true;
                    break;
                b = true;
                break;
            }
            if (b == false)
            {
@@ -337,7 +338,16 @@
                oCn.BeginTran();
                //生成出入库单据
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HSourceBillType + "'");
                DataSet ds = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HSourceBillType + "'", "h_p_Kf_ProductInBillSub_Insert_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                }
                else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) != "OK")
                {
                    oCn.RollBack();
                    MessageBox.Show("生成入库单失败,当前称重记录列表无数据,不允许换班生成单据!", "提示");
                    return false;
                }
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain " +
                    "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
@@ -541,6 +551,22 @@
                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;
        }
@@ -610,6 +636,8 @@
            string ProcessExchangeBillNo = "";
            Int64 HBarcodeNo = 0;       //包数
            Int64 HBadReasonID = 0;     //不良原因ID
            string HCusMaterName = "";  //客户物料名称
            string HCusModel = "";      //客户规格型号
            HBarCode = TM;
            HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text);
@@ -623,11 +651,13 @@
            ProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text);
            HBarcodeNo = DBUtility.ClsPub.isLong(txtHBarcodeNo.Text);
            HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag);
            HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text);
            HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text);
            try
            {
                oCn.BeginTran();
                //写入条码档案
                //写入条码档案    (客户物料名称HCusMaterName存入HMaterialModel字段,客户规格型号HCusModel存入HCusModel字段
                oCn.RunProc("Insert into Gy_BarCodeBill " +
                "(HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
@@ -635,7 +665,7 @@
                ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty " +
                ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " +
                ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1 " +
                ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
                ") Values ("
                + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
@@ -644,7 +674,7 @@
                + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString()
                + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0"
                + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'," + HBadReasonID.ToString()
                + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'"
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','')");
                //回填最大流水号
@@ -695,6 +725,8 @@
            txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("物料名称")].Value);
            txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("规格型号")].Value);
            txtHBatchNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("批号")].Value);
            txtHCusMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusMaterName")].Value);
            txtHCusModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusModel")].Value);
            HAuxPropID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HAuxPropID")].Value);
            HUnitID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HUnitID")].Value);
            HWhID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HWhID")].Value);
@@ -707,6 +739,7 @@
            HSourceQty = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("数量")].Value);
            ProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ProcessExchangeInterID")].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);
        }
        //返回源单列表信息