﻿CREATE OR ALTER PROCEDURE [dbo].[计划排产_阀类装配任务_修改预计送检日期]
    @editstr nvarchar(100),
    @订单号 int=0
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @whereStr nvarchar(max)=' where 1=1 ';
    DECLARE @updateStr nvarchar(max)='update [MES_接口_生产计划] set ';
    DECLARE @selStr nvarchar(max)='';

    IF(@订单号>0) SET @whereStr=@whereStr + ' and [订单编号]='+CONVERT(varchar(10),@订单号);
    IF(@editstr<>'') SET @updateStr = @updateStr + @editstr;
    SET @selStr=@updateStr+@whereStr;

    PRINT @selStr;
    EXEC sp_executesql @selStr;
    SELECT '1' AS result;
END;
GO

CREATE OR ALTER PROCEDURE [dbo].[计划排产_阀类装配任务_修改销售要求日期]
    @editstr nvarchar(100),
    @订单号 int=0
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @whereStr nvarchar(max)=' where 1=1 ';
    DECLARE @updateStr nvarchar(max)='update [MES_接口_生产计划] set ';
    DECLARE @selStr nvarchar(max)='';

    IF(@订单号>0) SET @whereStr=@whereStr + ' and [订单编号]='+CONVERT(varchar(10),@订单号);
    IF(@editstr<>'') SET @updateStr = @updateStr + @editstr;
    SET @selStr=@updateStr+@whereStr;

    PRINT @selStr;
    EXEC sp_executesql @selStr;
    SELECT '1' AS result;
END;