From 81456046161696d3e1e31a8d9eb428f3b7a3442f Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期四, 22 九月 2022 10:44:56 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs | 136 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 118 insertions(+), 18 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
index 7338fc0..82c05ac 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
@@ -1,4 +1,5 @@
锘縰sing Newtonsoft.Json.Linq;
+using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
@@ -12,9 +13,16 @@
{
public class Sc_MESEndWorkBillController : ApiController
{
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+
private json objJsonResult = new json();
public DataSet ds = new DataSet();
public WebServer webserver = new WebServer();
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
+ public DAL.ClsSc_MESEndWorkBill BillNew = new DAL.ClsSc_MESEndWorkBill(); //瀵瑰簲鍗曟嵁绫�
+ public DAL.ClsSc_MESEndWorkBill BillOld = new DAL.ClsSc_MESEndWorkBill(); //瀵瑰簲鍗曟嵁绫�
#region 瀹屽伐鍗�
@@ -188,17 +196,18 @@
/// <returns></returns>
[Route("Sc_MESEndWorkBill/DeltetMESEndWorkBill")]
[HttpGet]
- public object DeltetMESEndWorkBill(string HInterID)
+ public object DeltetMESEndWorkBill(string HInterID,string UserName)
{
+ DBUtility.ClsPub.CurUserName = UserName;
//缂栬緫鏉冮檺
- //if (!DBUtility.ClsPub.Security_Log("Sc_MESEndWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
+ if (!DBUtility.ClsPub.Security_Log_second("MES_MESEndWorkBill_Delete", 1, false, DBUtility.ClsPub.CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
Int64 lngBillKey = 0;
@@ -278,7 +287,7 @@
try
{
//瀹℃牳鏉冮檺
- if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -360,8 +369,8 @@
}
else
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
@@ -380,8 +389,8 @@
}
else
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
@@ -406,7 +415,7 @@
#region 鎶ュ伐骞冲彴瀹屽伐鍗曚繚瀛�/缂栬緫
/// <summary>
- /// 寮�宸ュ崟
+ /// 瀹屽伐鍗�
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
@@ -418,10 +427,34 @@
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
+ string UserName = sArray[1].ToString();
+ string refSav = sArray[2].ToString();
+ DBUtility.ClsPub.CurUserName = UserName;
+
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("MES_MESEndWorkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
- string UserName = "";
ListModels oListModels = new ListModels();
try
{
@@ -432,8 +465,58 @@
lsmain = oListModels.getObjectByJson_Gy_MESEndWorkBillMain(msg2);
foreach (Models.ClsSc_MESEndWorkBillMain oItem in lsmain)
{
+ if (refSav == "Add")
+ {
+ //鍗曟嵁鍙锋槸鍚﹂噸澶�
+ if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ if (refSav == "Update")
+ {
+ if (BillOld.ShowBill(oItem.HInterID, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (BillOld.omodel.HBillStatus > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
//oItem.HMaker = "";
UserName = oItem.HMaker; //鍒跺崟浜�
+ DBUtility.ClsPub.CurUserName = oItem.HMaker;
oItem.HBillType = "3788";
oItem.HBillSubType = "3788";
oItem.HReportType = "3";//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
@@ -457,16 +540,33 @@
bool bResult;
if (oBill.omodel.HInterID == 0)
{
- // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ if (bResult)
+ {
+ objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D
+ //绯荤粺鍙傛暟 鑷姩瀹℃牳
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ if (oSystemParameter.omodel.Sc_MESEndWorkBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳
+ {
+ objJsonResult.Verify = "Y";
+ }
+ else
+ {
+ objJsonResult.Verify = "N";
+ }
+ }
+ }
}
else
{
bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ objJsonResult.Verify = "N";
}
if (bResult)
{
- objJsonResult.code = "0";
+ objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
//WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
--
Gitblit v1.9.1