From 146fa02f2ff92f9687fc9e099e2e812f785e04b1 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期一, 25 四月 2022 13:32:32 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
PlanM/数据导入/Gy_StdWorkTimes_RoutingBill.cs | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 215 insertions(+), 4 deletions(-)
diff --git "a/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_StdWorkTimes_RoutingBill.cs" "b/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_StdWorkTimes_RoutingBill.cs"
index 40db531..095e1cd 100644
--- "a/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_StdWorkTimes_RoutingBill.cs"
+++ "b/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_StdWorkTimes_RoutingBill.cs"
@@ -1,19 +1,230 @@
-锘縰sing System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
-using System.Linq;
using System.Text;
using System.Windows.Forms;
+using Pub_Class;
+using SQLHelper;
-namespace PlanM.鏁版嵁瀵煎叆
+namespace PlanM
{
- public partial class Gy_StdWorkTimes_RoutingBill : Form
+ public partial class Gy_StdWorkTimes_RoutingBill : BLL.Gy_DataInTmp
{
public Gy_StdWorkTimes_RoutingBill()
{
InitializeComponent();
}
+ public int HItemID =0;
+ public int HMaker = 0; //制单人
+ public int HMakeDate = 0; //制单日期
+ public int HChecker = 0; //审核人
+ public int HCheckDate = 0; //审核日期
+ public int HStopflag = 0;
+ public int HRemark = 0;
+ public int HUSEORGName = 0; //组织ID
+ public int HProcName = 0; //
+ public int HMaterName = 0; //物料ID
+ public int HProcNum = 0; //
+ public int HMaterNum = 0; //物料ID
+ public int HStdWorkTimes = 0; //标准工时
+ public int HUpperlimit = 0; //上限比例
+ public int HLowerlimit = 0; //下限比例
+ public int HStdPiece = 0; //上限比例
+ public int HStdPric = 0; //下限比例
+ //
+ public const int HBeginRow = 2; //有效数据,开始行数
+
+
+ //
+ public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
+ public DAL.ClsGy_StdWorkTimes_Ctl BillNew = new DAL.ClsGy_StdWorkTimes_Ctl();
+ DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
+
+
+
+ public override bool OpenExcelData()
+ {
+ base.sSheetName = txtHSheetName.Text;
+ return base.OpenExcelData();
+ }
+
+
+ /// <summary>
+ /// 初始化界面
+ /// </summary>
+ public override void initData()
+ {
+ base.initData();
+ base.sSheetName = "标准工时";
+ base.ModRightName = "Gy_StdWorkTimes_RoutingBill";
+ base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck;
+ base.ModRightNameClose = base.ModRightName + base.ModRightNameClose;
+ base.ModRightNameDelete = base.ModRightName + base.ModRightNameDelete;
+ base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit;
+ base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney;
+ base.ModRightNameQty = base.ModRightName + base.ModRightNameQty;
+ base.ModCaption = "标准工时";
+ this.Text = base.ModCaption;
+ lblCaption.Text = base.ModCaption;
+ //
+ DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear);
+ DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod);
+ //
+ }
+
+ public override void Sub_DataIn()
+ {
+ int sHStdWorkTimesCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准工时", grdMain);
+ int sHProcNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序代码", grdMain);
+ int sHProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序", grdMain);
+ int sHMaterNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("物料代码", grdMain);
+ int sHMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("物料", grdMain);
+ int sHUpperlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("上线比例", grdMain);
+ int sHLowerlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("下线比例", grdMain);
+ int sHStdPieceCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准计件", grdMain);
+ int sHStdPricCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准计价", grdMain);
+ int sHUSEORGNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("组织", grdMain);
+ int sHMakerCol = DBUtility.Gy_BaseFun.Fun_GetCol("制单人", grdMain);
+ int sHMakeDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("制单日期", grdMain);
+
+ for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
+ {
+ if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHMaterNumCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHProcNumCol].Value) != ""&& DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHStdWorkTimesCol].Value) != "")
+ {
+ if (DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHStdWorkTimesCol].Value)>0&& DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHUpperlimitCol].Value) > 0&& DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHLowerlimitCol].Value) > 0)
+ {
+ //写入类
+ if (WriteClass(i))
+ {
+ //保存记录
+ if (!BillNew.AddNew())
+ {
+ MessageBox.Show("导入失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
+ return;
+ }
+ }
+ }
+ else
+ {
+ MessageBox.Show("第" + (i + 1) + "行,标准工时、上限比例和下限比例不能小于0", "提示");
+ return;
+ }
+ }
+ else
+ {
+ MessageBox.Show("第"+(i+1)+"行,工序代码、物料代码和标准工时不能为空!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
+ return;
+ }
+ }
+ MessageBox.Show("导入完毕");
+ grdMain.DataSource = null;
+ }
+
+ //写入类 从控件
+ private bool WriteClass(int row)
+ {
+ BillNew.DetailColl.Clear();
+ string sMaterNumber = "";
+ string sMaterName = "";
+ string sProcNumber = "";
+ string sProcName = "";
+ double sStdWorkTimes = 0;
+ double sUpperlimit = 0;
+ double sLowerlimit = 0;
+ double sStdPiece = 0;
+ double sStdPric= 0;
+ int sUSEORGName = 0;
+ DateTime sHMakeDate = DateTime.Today.Date;
+ string sHMaker = DBUtility.ClsPub.CurUserName;
+
+ int sHStdWorkTimesCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准工时", grdMain);
+ int sHProcNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序代码", grdMain);
+ int sHProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序", grdMain);
+ int sHMaterNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("物料代码", grdMain);
+ int sHMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("物料", grdMain);
+ int sHUpperlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("上线比例", grdMain);
+ int sHLowerlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("下线比例", grdMain);
+ int sHStdPieceCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准计件", grdMain);
+ int sHStdPricCol = DBUtility.Gy_BaseFun.Fun_GetCol("标准计价", grdMain);
+ int sHUSEORGNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("组织", grdMain);
+ int sHMakerCol = DBUtility.Gy_BaseFun.Fun_GetCol("制单人", grdMain);
+ int sHMakeDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("制单日期", grdMain);
+ //
+ sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMaterNumCol].Value);
+ //sMaterName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMaterNameCol].Value);
+ sProcNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHProcNumCol].Value);
+ //sProcName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHProcNameCol].Value);
+ sStdWorkTimes = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdWorkTimesCol].Value);
+ sUpperlimit = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHUpperlimitCol].Value);
+ sLowerlimit = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHLowerlimitCol].Value);
+ sStdPiece = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdPieceCol].Value);
+ sStdPric = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdPricCol].Value);
+ //sUSEORGName = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[sHUSEORGNameCol].Value);
+ //sHMakeDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sHMakeDateCol].Value);
+ //sHMaker = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMakerCol].Value);
+
+ //判断是否允许 保存
+
+ //审核代码是否合理
+ if (!DBUtility.ClsPub.AllowNumber(sMaterNumber))
+ {
+ MessageBox.Show("产品代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
+ return false;
+ }
+ if (!DBUtility.ClsPub.AllowNumber(sProcNumber))
+ {
+ MessageBox.Show("工序代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
+ return false;
+ }
+
+ Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model();
+ //得到物料内码
+ if (oMaterHlp.GetInfoByNumber(sMaterNumber))
+ {
+ oSub.HMaterID = oMaterHlp.omodel.HItemID;
+ }
+ else
+ {
+ oSub.HMaterID = 0;
+ MessageBox.Show("第" + row.ToString() + "行," + sMaterNumber + "没有找到对应的物料!");
+ return false;
+ }
+ //得到工序内码
+ if (oProcHlp.GetInfoByNumber(sProcNumber))
+ {
+ oSub.HProcID = oProcHlp.omodel.HItemID;
+ }
+ else
+ {
+ oSub.HProcID = 0;
+ MessageBox.Show("第" + row.ToString() + "行," + sProcNumber + "没有找到对应的工序!");
+ return false;
+ }
+
+ //写入信息
+
+ oSub.HRemark = "";
+ oSub.HStdWorkTimes = sStdWorkTimes;
+ oSub.HUpperlimit = sUpperlimit;
+ oSub.HLowerlimit = sLowerlimit;
+ oSub.HStdPiece = sStdPiece;
+ oSub.HStdPric = sStdPric;
+ oSub.HUSEORGID = DBUtility.ClsPub.HOrgID;
+ oSub.HMaker = DBUtility.ClsPub.CurUserName;
+ oSub.HMakeDate = DateTime.Today.ToShortDateString();
+ BillNew.DetailColl.Add(oSub);
+ //oProc.oModel.HBillSubType = DBUtility.ClsPub.isStrNull(txtHBillSubType.Text);
+
+ return true;
+ }
+
+
+ private void Gy_StdWorkTimes_RoutingBill_Load(object sender, EventArgs e)
+ {
+
+ }
}
}
+
--
Gitblit v1.9.1